Fixes/improvements:
 - Leaders command uses candidateBoard keys when using -c (list candidates)
   option.
 - Bug fix for lock retry

Change-Id: I42730a85b720fc5023b9b07bef153d975c95d4df
diff --git a/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DistributedLeadershipManager.java b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DistributedLeadershipManager.java
index fe702ee..0b2b4cb 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DistributedLeadershipManager.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DistributedLeadershipManager.java
@@ -283,19 +283,23 @@
         if (!activeTopics.contains(path)) {
             return;
         }
-
-        Versioned<List<NodeId>> candidates = candidateMap.get(path);
-        if (candidates != null) {
-            List<NodeId> activeNodes = candidates.value().stream()
-                              .filter(n -> clusterService.getState(n) == ACTIVE)
-                              .collect(Collectors.toList());
-            if (localNodeId.equals(activeNodes.get(LEADER_CANDIDATE_POS))) {
-                leaderLockAttempt(path, candidates.value());
+        try {
+            Versioned<List<NodeId>> candidates = candidateMap.get(path);
+            if (candidates != null) {
+                List<NodeId> activeNodes = candidates.value().stream()
+                                  .filter(n -> clusterService.getState(n) == ACTIVE)
+                                  .collect(Collectors.toList());
+                if (localNodeId.equals(activeNodes.get(LEADER_CANDIDATE_POS))) {
+                    leaderLockAttempt(path, candidates.value());
+                } else {
+                    retryLock(path);
+                }
             } else {
-                retryLock(path);
+                throw new IllegalStateException("should not be here");
             }
-        } else {
-            throw new IllegalStateException("should not be here");
+        } catch (Exception e) {
+            log.debug("Failed to fetch candidate information for {}", path, e);
+            retryLock(path);
         }
     }
 
@@ -336,7 +340,7 @@
         final MutableBoolean updated = new MutableBoolean(false);
         candidateBoard.compute(path, (k, current) -> {
             if (current == null || current.epoch() < newInfo.epoch()) {
-                log.info("updating candidateboard with {}", newInfo);
+                log.debug("updating candidateboard with {}", newInfo);
                 updated.setTrue();
                 return newInfo;
             }