Browse Source

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>
stable-5.4
Matthias Sohn 6 years ago
parent
commit
7383d34737
  1. 9
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java

9
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 { class Version extends TextBuiltin {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() {
// read the Implementation-Version from Manifest // read the Implementation-Version from Manifest
String version = getImplementationVersion(); String version = getImplementationVersion();
@ -71,7 +71,12 @@ class Version extends TextBuiltin {
if (version == null) if (version == null)
throw die(CLIText.get().cannotReadPackageInformation); 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} */ /** {@inheritDoc} */

Loading…
Cancel
Save