From 766ab916ee976272f354291765e4d6595d21b968 Mon Sep 17 00:00:00 2001 From: David Solin Date: Wed, 21 Dec 2016 07:48:02 -0600 Subject: [PATCH 1/2] Use cause message when initializing an SSHRuntimeException from a Throwable. --- src/main/java/net/schmizz/sshj/common/SSHRuntimeException.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/schmizz/sshj/common/SSHRuntimeException.java b/src/main/java/net/schmizz/sshj/common/SSHRuntimeException.java index 022adcd8..b9afd48f 100644 --- a/src/main/java/net/schmizz/sshj/common/SSHRuntimeException.java +++ b/src/main/java/net/schmizz/sshj/common/SSHRuntimeException.java @@ -34,7 +34,7 @@ public class SSHRuntimeException } public SSHRuntimeException(Throwable cause) { - this(null, cause); + this(cause.getMessage(), cause); } } From 9e3b9f7c248d00a1e6261e09d38981c20ab2ad3e Mon Sep 17 00:00:00 2001 From: David Solin Date: Wed, 21 Dec 2016 10:04:56 -0600 Subject: [PATCH 2/2] Obtain the sshj.properties resource from the ClassLoader that loaded the DefaultConfig class, not from the context classloader. --- src/main/java/net/schmizz/sshj/DefaultConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/schmizz/sshj/DefaultConfig.java b/src/main/java/net/schmizz/sshj/DefaultConfig.java index 03fd2cab..b9cd651c 100644 --- a/src/main/java/net/schmizz/sshj/DefaultConfig.java +++ b/src/main/java/net/schmizz/sshj/DefaultConfig.java @@ -85,7 +85,7 @@ public class DefaultConfig private String readVersionFromProperties() { try { Properties properties = new Properties(); - properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("sshj.properties")); + properties.load(DefaultConfig.class.getClassLoader().getResourceAsStream("sshj.properties")); String property = properties.getProperty("sshj.version"); return "SSHJ_" + property.replace('-', '_'); // '-' is a disallowed character, see RFC-4253#section-4.2 } catch (IOException e) {