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>
This commit is contained in:
parent
1b16fed56a
commit
a19ad89d99
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
package org.eclipse.jgit.pgm;
|
package org.eclipse.jgit.pgm;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ class LsTree extends TextBuiltin {
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
protected void run() throws Exception {
|
protected void run() {
|
||||||
try (TreeWalk walk = new TreeWalk(db)) {
|
try (TreeWalk walk = new TreeWalk(db)) {
|
||||||
walk.reset(); // drop the first empty tree, which we do not need here
|
walk.reset(); // drop the first empty tree, which we do not need here
|
||||||
if (paths.size() > 0)
|
if (paths.size() > 0)
|
||||||
|
@ -95,6 +96,8 @@ protected void run() throws Exception {
|
||||||
outw.print(QuotedString.GIT_PATH.quote(walk.getPathString()));
|
outw.print(QuotedString.GIT_PATH.quote(walk.getPathString()));
|
||||||
outw.println();
|
outw.println();
|
||||||
}
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw die(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue