From c2fb5873b445c005b40544ee47134d2eca9a61d7 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Sun, 20 Jan 2019 21:12:03 +0100 Subject: [PATCH] pgm: Handle exceptions in DiffTree command This avoids we show a stacktrace on the console by default when this type of exception is thrown during the run method is executed. Change-Id: I087b3e510682c68cae74c069b10050c7acb48a29 Signed-off-by: Matthias Sohn --- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java index 42aabc2f4..b6cf84165 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java @@ -44,6 +44,7 @@ package org.eclipse.jgit.pgm; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -74,7 +75,7 @@ class DiffTree extends TextBuiltin { /** {@inheritDoc} */ @Override - protected void run() throws Exception { + protected void run() { try (TreeWalk walk = new TreeWalk(db)) { walk.setRecursive(recursive); for (AbstractTreeIterator i : trees) @@ -116,6 +117,8 @@ class DiffTree extends TextBuiltin { outw.print(walk.getPathString()); outw.println(); } + } catch (IOException e) { + throw die(e.getMessage(), e); } } }