Commit 4d5b97c4 authored by dbh's avatar dbh Committed by akrherz

OF-1467, Check nodeRoutes.containsKeys(key) to avoid NPE (#999)

* OF-1467, Check nodeRoutes.containsKeys(key) to avoid Null Pointer Exception in ClusterListener, nodeCleanup, when there are no sessions on the node to cleanup

* Good point. Tweak to fix as per suggestion.
parent e144967e
...@@ -280,13 +280,14 @@ public class ClusterListener implements MembershipListener, LifecycleListener { ...@@ -280,13 +280,14 @@ public class ClusterListener implements MembershipListener, LifecycleListener {
// Remove outgoing server sessions hosted in node that left the cluster // Remove outgoing server sessions hosted in node that left the cluster
Set<DomainPair> remoteServers = nodeRoutes.get(key); Set<DomainPair> remoteServers = nodeRoutes.get(key);
if (!remoteServers.isEmpty()) { if (remoteServers!=null) {
for (DomainPair domainPair : remoteServers) { for (DomainPair domainPair : remoteServers) {
routingTable.removeServerRoute(domainPair); routingTable.removeServerRoute(domainPair);
} }
} }
nodeRoutes.remove(key); nodeRoutes.remove(key);
Set<String> components = lookupJIDList(key, componentsCache.getName()); Set<String> components = lookupJIDList(key, componentsCache.getName());
if (!components.isEmpty()) { if (!components.isEmpty()) {
for (String address : new ArrayList<String>(components)) { for (String address : new ArrayList<String>(components)) {
......
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