commit | e3bfcafade601e1c07830c3eddd7b02fb62484d6 | [log] [tgz] |
---|---|---|
author | Ayaka Koshibe <ayaka@onlab.us> | Tue Apr 21 14:29:58 2015 -0700 |
committer | Gerrit Code Review <gerrit@onlab.us> | Wed Apr 22 20:49:44 2015 +0000 |
tree | 773b9302a7413af6dc4fe3febabe737e70123ce6 | |
parent | 6cba495a6f29204e8ace7b61fcf493c31e43f908 [diff] |
Fix NPE for election app when handling CANDIDATE events. Also disables running for leadership automatically at startup. Change-Id: I27f297fdd4b62f9cd345df88a772f76ade56d350
diff --git a/apps/test/election/src/main/java/org/onosproject/election/ElectionTest.java b/apps/test/election/src/main/java/org/onosproject/election/ElectionTest.java index 7d6ea56..b2a7207 100644 --- a/apps/test/election/src/main/java/org/onosproject/election/ElectionTest.java +++ b/apps/test/election/src/main/java/org/onosproject/election/ElectionTest.java
@@ -68,7 +68,6 @@ localControllerNode = clusterService.getLocalNode(); leadershipService.addListener(leadershipEventListener); - leadershipService.runForLeadership(appId.name()); } @Deactivate @@ -90,6 +89,9 @@ public void event(LeadershipEvent event) { + if (event.type().equals(LeadershipEvent.Type.CANDIDATES_CHANGED)) { + return; + } if (!event.subject().topic().equals(appId.name())) { return; // Not our topic: ignore }