]> source.dussan.org Git - jgit.git/commitdiff
Terminate StreamCopy threads in case of errors 03/92903/4
authorDmitry Neverov <dmitry.neverov@gmail.com>
Mon, 13 Mar 2017 11:05:44 +0000 (12:05 +0100)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Sat, 30 Sep 2017 13:01:16 +0000 (14:01 +0100)
Bug: 513554
Change-Id: I065836b8fc77ade6de92e4a809fcf770a4f793ec
Signed-off-by: Dmitry Neverov <dmitry.neverov@gmail.com>
org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java

index 82d6ed4e48437f6b60a9b525a4313b6468db518c..a8cc03200615d14faba5df96fb3c75595f4e3a11 100644 (file)
@@ -220,6 +220,7 @@ public class JschSession implements RemoteSession {
                public void destroy() {
                        if (channel.isConnected())
                                channel.disconnect();
+                       closeOutputStream();
                }
 
                @Override
index 9a40f47cb773321d5956337b37e49c0a6ef233b6..ede5a7ae3386eeecbc3b212e0a65baa8a242bff5 100644 (file)
@@ -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 {