summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-01-20 21:37:04 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2019-01-21 00:54:14 +0100
commita19ad89d990777990c9e422ca478ff0b314cd5fa (patch)
tree3a412a690050b93f31e0cbb5500981fb240e97aa /org.eclipse.jgit.pgm/src
parent1b16fed56a37a9ff14f7f2d2a45dd16a9fe31f51 (diff)
downloadjgit-a19ad89d990777990c9e422ca478ff0b314cd5fa.tar.gz
jgit-a19ad89d990777990c9e422ca478ff0b314cd5fa.zip
pgm: Handle exceptions in LsTree 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: Ib3ae59eeb90143eca1a0b515c59457a0eb2cc383 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm/src')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java
index 01fa7eeb81..d2bf9ac187 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java
@@ -45,6 +45,7 @@
package org.eclipse.jgit.pgm;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -72,7 +73,7 @@ class LsTree extends TextBuiltin {
/** {@inheritDoc} */
@Override
- protected void run() throws Exception {
+ protected void run() {
try (TreeWalk walk = new TreeWalk(db)) {
walk.reset(); // drop the first empty tree, which we do not need here
if (paths.size() > 0)
@@ -95,6 +96,8 @@ class LsTree extends TextBuiltin {
outw.print(QuotedString.GIT_PATH.quote(walk.getPathString()));
outw.println();
}
+ } catch (IOException e) {
+ throw die(e.getMessage(), e);
}
}
}