Commit 4a8af392 authored by Dave Cridland's avatar Dave Cridland

Merge pull request #543 from cliffchung/master

Fixing NPE in RemoteSession
parents e7fa892b f6ba4f7a
...@@ -109,12 +109,14 @@ public abstract class RemoteSession implements Session { ...@@ -109,12 +109,14 @@ public abstract class RemoteSession implements Session {
public long getNumClientPackets() { public long getNumClientPackets() {
ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.getNumClientPackets); ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.getNumClientPackets);
return (Long) doSynchronousClusterTask(task); final Object clusterTaskResult = doSynchronousClusterTask(task);
return clusterTaskResult == null ? -1 : (Long) clusterTaskResult;
} }
public long getNumServerPackets() { public long getNumServerPackets() {
ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.getNumServerPackets); ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.getNumServerPackets);
return (Long) doSynchronousClusterTask(task); final Object clusterTaskResult = doSynchronousClusterTask(task);
return clusterTaskResult == null ? -1 : (Long) clusterTaskResult;
} }
public String getCipherSuiteName() { public String getCipherSuiteName() {
...@@ -137,12 +139,14 @@ public abstract class RemoteSession implements Session { ...@@ -137,12 +139,14 @@ public abstract class RemoteSession implements Session {
public boolean isClosed() { public boolean isClosed() {
ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.isClosed); ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.isClosed);
return (Boolean) doSynchronousClusterTask(task); final Object clusterTaskResult = doSynchronousClusterTask(task);
return clusterTaskResult == null ? false : (Boolean) clusterTaskResult;
} }
public boolean isSecure() { public boolean isSecure() {
ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.isSecure); ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.isSecure);
return (Boolean) doSynchronousClusterTask(task); final Object clusterTaskResult = doSynchronousClusterTask(task);
return clusterTaskResult == null ? false : (Boolean) clusterTaskResult;
} }
public String getHostAddress() throws UnknownHostException { public String getHostAddress() throws UnknownHostException {
...@@ -167,7 +171,8 @@ public abstract class RemoteSession implements Session { ...@@ -167,7 +171,8 @@ public abstract class RemoteSession implements Session {
public boolean validate() { public boolean validate() {
ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.validate); ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.validate);
return (Boolean) doSynchronousClusterTask(task); final Object clusterTaskResult = doSynchronousClusterTask(task);
return clusterTaskResult == null ? false : (Boolean) clusterTaskResult;
} }
abstract RemoteSessionTask getRemoteSessionTask(RemoteSessionTask.Operation operation); abstract RemoteSessionTask getRemoteSessionTask(RemoteSessionTask.Operation operation);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment