diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-21 23:54:28 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-21 23:54:28 +0100 |
commit | 7383d34737d94497545b3e9c261c52d985ee6c04 (patch) | |
tree | e7b4e0a20f34a6394a00419e6697d82ff9d4c589 /org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java | |
parent | e74592605e8ff1816684f62f0d816dd0ec04ffef (diff) | |
download | jgit-7383d34737d94497545b3e9c261c52d985ee6c04.tar.gz jgit-7383d34737d94497545b3e9c261c52d985ee6c04.zip |
pgm: Handle IOException in Version 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: I37e6e3aaba411858042afac02098ce9eaa06f258
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java index 58acc5cafd..1979971884 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java @@ -57,7 +57,7 @@ import org.eclipse.jgit.pgm.internal.CLIText; class Version extends TextBuiltin { /** {@inheritDoc} */ @Override - protected void run() throws Exception { + protected void run() { // read the Implementation-Version from Manifest String version = getImplementationVersion(); @@ -71,7 +71,12 @@ class Version extends TextBuiltin { if (version == null) throw die(CLIText.get().cannotReadPackageInformation); - outw.println(MessageFormat.format(CLIText.get().jgitVersion, version)); + try { + outw.println( + MessageFormat.format(CLIText.get().jgitVersion, version)); + } catch (IOException e) { + throw die(e.getMessage(), e); + } } /** {@inheritDoc} */ |