summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/SshUtil.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/SshUtil.java b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/SshUtil.java
index d00049de..ed45305d 100644
--- a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/SshUtil.java
+++ b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/utils/SshUtil.java
@@ -295,7 +295,12 @@ public class SshUtil {
// remove the connection from cache and close it
sshConnCache.remove(sshConnection);
sshConnection.close();
- throw new GlusterRuntimeException(errMsg, e);
+ if(e instanceof IllegalStateException) {
+ // The connection is no more valid. Create and throw a connection exception.
+ throw new ConnectionException("Couldn't open SSH session on [" + sshConnection.getHostname() + "]!", e);
+ } else {
+ throw new GlusterRuntimeException(errMsg, e);
+ }
} finally {
if(session != null) {
session.close();