diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-21 23:41:37 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-21 23:41:37 +0100 |
commit | e5511f2fbbf363e3ae78927120a86c380d6566d9 (patch) | |
tree | d4e3ccc2b16ad98cf4ce9dd482f6df3a5f7b5936 /org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm | |
parent | 9ef393c7475248088cef3e0c3a173df889968077 (diff) | |
download | jgit-e5511f2fbbf363e3ae78927120a86c380d6566d9.tar.gz jgit-e5511f2fbbf363e3ae78927120a86c380d6566d9.zip |
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>
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java index 89a15fe4d8..fe2c0d5c53 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java @@ -59,6 +59,7 @@ import org.eclipse.jgit.diff.RenameDetector; 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 @@ class Show extends TextBuiltin { /** {@inheritDoc} */ @SuppressWarnings("boxing") @Override - protected void run() throws Exception { + protected void run() { diffFmt.setRepository(db); try { diffFmt.setPathFilter(pathFilter); @@ -224,6 +225,8 @@ class Show extends TextBuiltin { obj.getType())); } } + } catch (RevisionSyntaxException | IOException e) { + throw die(e.getMessage(), e); } finally { diffFmt.close(); } @@ -273,7 +276,7 @@ class Show extends TextBuiltin { } } - 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); |