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>
This commit is contained in:
parent
3b94cd008f
commit
8615c042ff
|
@ -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 @@ protected final boolean requiresRepository() {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected void run() throws Exception {
|
||||
protected void run() {
|
||||
final org.eclipse.jgit.transport.ReceivePack rp;
|
||||
|
||||
try {
|
||||
|
@ -75,9 +76,15 @@ protected void run() throws Exception {
|
|||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue