Browse Source

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>
tags/v4.9.0.201710071750-r
Till Brychcy 6 years ago
parent
commit
401c6c98b5
1 changed files with 12 additions and 4 deletions
  1. 12
    4
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java

+ 12
- 4
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java View File

@@ -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 {

Loading…
Cancel
Save