diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java index 82d6ed4e4..a8cc03200 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java @@ -220,6 +220,7 @@ public class JschSession implements RemoteSession { public void destroy() { if (channel.isConnected()) channel.disconnect(); + closeOutputStream(); } @Override 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 9a40f47cb..ede5a7ae3 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 (IOException err) { - close(); + } catch (Throwable err) { throw new TransportException(uri, JGitText.get().remoteHungUpUnexpectedly, err); + } finally { + close(); } try { @@ -341,12 +341,12 @@ public class TransportGitSsh extends SshTransport implements PackTransport { init(process.getInputStream(), process.getOutputStream()); } catch (TransportException err) { - close(); throw err; - } catch (IOException err) { - close(); + } catch (Throwable err) { throw new TransportException(uri, JGitText.get().remoteHungUpUnexpectedly, err); + } finally { + close(); } try {