From 7383d34737d94497545b3e9c261c52d985ee6c04 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Mon, 21 Jan 2019 23:54:28 +0100 Subject: [PATCH] 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 --- .../src/org/eclipse/jgit/pgm/Version.java | 9 +++++++-- 1 file 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 58acc5caf..197997188 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} */