commit | 1f13d64858bb19aea016dbffe015edffe4a02ea4 | [log] [tgz] |
---|---|---|
author | Jon Hall <jhall@ciena.com> | Fri May 13 17:53:01 2016 -0700 |
committer | Gerrit Code Review <gerrit@onlab.us> | Mon May 16 17:28:21 2016 +0000 |
tree | b9ebf7461ad5ded5934c87ecd82bc76a613fd347 | |
parent | 5182a26a8fe0df5b0ea84d3835ca972dd5ea92b6 [diff] |
Fix NPE caused by pushing events about nodes no longer in the cluster Change-Id: I7a1da3d7824b07b446194d651ef4945f1305bce3
diff --git a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java index e6163a9..1c6c7a7 100644 --- a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java +++ b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java
@@ -258,6 +258,11 @@ private void notifyStateChange(NodeId nodeId, State oldState, State newState) { if (oldState != newState) { ControllerNode node = allNodes.get(nodeId); + // Either this node or that node is no longer part of the same cluster + if (node == null) { + log.warn("Could not find node {} in the cluster, ignoring state change", node); + return; + } ClusterEvent.Type type = newState == State.READY ? INSTANCE_READY : newState == State.ACTIVE ? INSTANCE_ACTIVATED : INSTANCE_DEACTIVATED; @@ -378,4 +383,4 @@ log.warn(e.getMessage()); } } -} \ No newline at end of file +}