summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-01-20 21:12:03 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2019-01-20 22:18:40 +0100
commitc2fb5873b445c005b40544ee47134d2eca9a61d7 (patch)
treeaf524ef4f09657ad4b22ecfe7f12a3e2ae3e2ce1
parente2d1736e69086dace6e91e2a810ee52f1748ef45 (diff)
downloadjgit-c2fb5873b445c005b40544ee47134d2eca9a61d7.tar.gz
jgit-c2fb5873b445c005b40544ee47134d2eca9a61d7.zip
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 <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java5
1 files changed, 4 insertions, 1 deletions
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 42aabc2f49..b6cf84165a 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);
}
}
}