pgm: Handle exceptions in Show 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: I1c6cc5ecdc44b81e5f3f9b7dc64c3653de5475ba Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
9ef393c747
commit
e5511f2fbb
|
@ -59,6 +59,7 @@
|
|||
import org.eclipse.jgit.errors.CorruptObjectException;
|
||||
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
|
||||
import org.eclipse.jgit.errors.MissingObjectException;
|
||||
import org.eclipse.jgit.errors.RevisionSyntaxException;
|
||||
import org.eclipse.jgit.lib.Constants;
|
||||
import org.eclipse.jgit.lib.FileMode;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
|
@ -175,7 +176,7 @@ protected void init(Repository repository, String gitDir) {
|
|||
/** {@inheritDoc} */
|
||||
@SuppressWarnings("boxing")
|
||||
@Override
|
||||
protected void run() throws Exception {
|
||||
protected void run() {
|
||||
diffFmt.setRepository(db);
|
||||
try {
|
||||
diffFmt.setPathFilter(pathFilter);
|
||||
|
@ -224,6 +225,8 @@ protected void run() throws Exception {
|
|||
obj.getType()));
|
||||
}
|
||||
}
|
||||
} catch (RevisionSyntaxException | IOException e) {
|
||||
throw die(e.getMessage(), e);
|
||||
} finally {
|
||||
diffFmt.close();
|
||||
}
|
||||
|
@ -273,7 +276,7 @@ private void show(RevTree obj) throws MissingObjectException,
|
|||
}
|
||||
}
|
||||
|
||||
private void show(RevWalk rw, RevCommit c) throws Exception {
|
||||
private void show(RevWalk rw, RevCommit c) throws IOException {
|
||||
char[] outbuffer = new char[Constants.OBJECT_ID_LENGTH * 2];
|
||||
|
||||
outw.print(CLIText.get().commitLabel);
|
||||
|
|
Loading…
Reference in New Issue