aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Brychcy <register.eclipse@brychcy.de>2017-10-04 10:40:23 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2017-10-07 00:03:45 +0200
commit401c6c98b54cddde38f0f50e8429eb7698a54fe8 (patch)
treead1bba89f9ac99cb155ebdd4f5436b82205f1688
parent65f9046547768187de89c3c8f1fdb243314675d8 (diff)
downloadjgit-401c6c98b54cddde38f0f50e8429eb7698a54fe8.tar.gz
jgit-401c6c98b54cddde38f0f50e8429eb7698a54fe8.zip
Terminate StreamCopy threads in case of errors
- fix NPE: don't invoke close() if no exception happened. Bug: 513554 Change-Id: I29f9b2ac1607ee26521e8aba334facd20e4ad79c Signed-off-by: Till Brychcy <register.eclipse@brychcy.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java
index ede5a7ae33..24bc058c41 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java
@@ -283,12 +283,12 @@ public class TransportGitSsh extends SshTransport implements PackTransport {
init(process.getInputStream(), process.getOutputStream());
} catch (TransportException err) {
+ close();
throw err;
} catch (Throwable err) {
+ close();
throw new TransportException(uri,
JGitText.get().remoteHungUpUnexpectedly, err);
- } finally {
- close();
}
try {
@@ -341,12 +341,20 @@ public class TransportGitSsh extends SshTransport implements PackTransport {
init(process.getInputStream(), process.getOutputStream());
} catch (TransportException err) {
+ try {
+ close();
+ } catch (Exception e) {
+ // ignore
+ }
throw err;
} catch (Throwable err) {
+ try {
+ close();
+ } catch (Exception e) {
+ // ignore
+ }
throw new TransportException(uri,
JGitText.get().remoteHungUpUnexpectedly, err);
- } finally {
- close();
}
try {