diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-21 23:14:24 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-21 23:14:24 +0100 |
commit | 8615c042ffd70ea8fec2dfd746279691ace74205 (patch) | |
tree | f2aecb3839e0552303e2e9ede879ffc22f3be945 /org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm | |
parent | 3b94cd008f6e068faf19258b4512ec8475014883 (diff) | |
download | jgit-8615c042ffd70ea8fec2dfd746279691ace74205.tar.gz jgit-8615c042ffd70ea8fec2dfd746279691ace74205.zip |
pgm: Handle IOException in ReceivePack 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: I9cecd236a8df8a2c2972d5da6031a121f25b1daa
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/ReceivePack.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java index f3baafb0b7..b601d80bcd 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java @@ -45,6 +45,7 @@ package org.eclipse.jgit.pgm; import java.io.File; +import java.io.IOException; import java.text.MessageFormat; import org.eclipse.jgit.errors.RepositoryNotFoundException; @@ -66,7 +67,7 @@ class ReceivePack extends TextBuiltin { /** {@inheritDoc} */ @Override - protected void run() throws Exception { + protected void run() { final org.eclipse.jgit.transport.ReceivePack rp; try { @@ -75,9 +76,15 @@ class ReceivePack extends TextBuiltin { } catch (RepositoryNotFoundException notFound) { throw die(MessageFormat.format(CLIText.get().notAGitRepository, dstGitdir.getPath())); + } catch (IOException e) { + throw die(e.getMessage(), e); } rp = new org.eclipse.jgit.transport.ReceivePack(db); - rp.receive(ins, outs, errs); + try { + rp.receive(ins, outs, errs); + } catch (IOException e) { + throw die(e.getMessage(), e); + } } } |