From bab630dedb8bb01fca3c1cb4c6c65ee85f4fbc3e Mon Sep 17 00:00:00 2001 From: Shireesh Anjal Date: Mon, 22 Aug 2011 12:40:50 +0530 Subject: Modified method executeCommand to throw ConnectionException if the cached SSH connection is no more valid. --- .../src/com/gluster/storage/management/gateway/utils/SshUtil.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') 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(); -- cgit