Browse Source

pgm: Handle IOException in Fetch 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: If8be68621c7135435cd067ef638460b175786b1b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-5.4
Matthias Sohn 6 years ago
parent
commit
7a64771b9e
  1. 4
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java

4
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java

@ -137,7 +137,7 @@ class Fetch extends AbstractFetchCommand implements FetchCommand.Callback {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() {
try (Git git = new Git(db)) { try (Git git = new Git(db)) {
FetchCommand fetch = git.fetch(); FetchCommand fetch = git.fetch();
if (fsck != null) if (fsck != null)
@ -169,7 +169,7 @@ class Fetch extends AbstractFetchCommand implements FetchCommand.Callback {
return; return;
showFetchResult(result); showFetchResult(result);
} catch (GitAPIException e) { } catch (GitAPIException | IOException e) {
throw die(e.getMessage(), e); throw die(e.getMessage(), e);
} }
} }

Loading…
Cancel
Save