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 ede5a7ae3..24bc058c4 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 {