Bläddra i källkod

Close copy threads in case of errors

Bug: 484775
Change-Id: I3c7105188e615b6b994261f4ece0c8abc98eb444
Signed-off-by: Dmitry Neverov <dmitry.neverov@gmail.com>
tags/v4.2.0.201601211800-r
Dmitry Neverov 8 år sedan
förälder
incheckning
9c71bf14b7
1 ändrade filer med 14 tillägg och 1 borttagningar
  1. 14
    1
      org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java

+ 14
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java Visa fil

@@ -149,14 +149,27 @@ public class JschSession implements RemoteSession {
channel.setCommand(commandName);
setupStreams();
channel.connect(timeout > 0 ? timeout * 1000 : 0);
if (!channel.isConnected())
if (!channel.isConnected()) {
closeOutputStream();
throw new TransportException(uri,
JGitText.get().connectionFailed);
}
} catch (JSchException e) {
closeOutputStream();
throw new TransportException(uri, e.getMessage(), e);
}
}

private void closeOutputStream() {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException ioe) {
// ignore
}
}
}

private void setupStreams() throws IOException {
inputStream = channel.getInputStream();


Laddar…
Avbryt
Spara