From dbef8e2537451150529cefd0eb51b69d3e2a19bb Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Tue, 29 Aug 2017 16:55:00 +0200 Subject: [PATCH] Pass along the original exception when an ssh connection fails Otherwise, the stack trace doesn't really tell anything. See for instance [1]. [1] https://www.eclipse.org/forums/index.php/t/1088535/ Change-Id: If22f2c63c36fec6b32818d2c2acecf20531b4185 Signed-off-by: Thomas Wolf --- .../jgit/transport/JschConfigSessionFactory.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java index 242d1c48b..7fe9066a3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java @@ -153,10 +153,13 @@ public abstract class JschConfigSessionFactory extends SshSessionFactory { } catch (JSchException je) { final Throwable c = je.getCause(); - if (c instanceof UnknownHostException) - throw new TransportException(uri, JGitText.get().unknownHost); - if (c instanceof ConnectException) - throw new TransportException(uri, c.getMessage()); + if (c instanceof UnknownHostException) { + throw new TransportException(uri, JGitText.get().unknownHost, + je); + } + if (c instanceof ConnectException) { + throw new TransportException(uri, c.getMessage(), je); + } throw new TransportException(uri, je.getMessage(), je); }