Bugfix for stale state not being cleared up when switch goes down.

Change-Id: Ieee11bbc4253789779c6cf2cc29d18c3173d9ec3
diff --git a/app/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java b/app/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
index adfe3f1..fe469d3 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
@@ -16,7 +16,6 @@
 package org.onosproject.segmentrouting.grouphandler;
 
 import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
@@ -470,31 +469,29 @@
             Set<DeviceId> currNeighbors = nhops.nextHops(destSw);
             int edgeLabel = dskey.destinationSet().getEdgeLabel(destSw);
             Integer nextId = nhops.nextId();
+            if (currNeighbors == null || nextHops == null) {
+                log.warn("fixing hash groups but found currNeighbors:{} or nextHops:{}"
+                        + " in targetSw:{} for dstSw:{}", currNeighbors,
+                         nextHops, targetSw, destSw);
+                success &= false;
+                continue;
+            }
 
             // some store elements may not be hashed next-objectives - ignore them
             if (isSimpleNextObjective(dskey)) {
-                Set<DeviceId> displayNextHops = nextHops == null ? ImmutableSet.of() : nextHops;
                 log.debug("Ignoring {} of SIMPLE nextObj for targetSw:{}"
                         + " -> dstSw:{} with current nextHops:{} to new"
                         + " nextHops: {} in nextId:{}",
                           (revoke) ? "removal" : "addition", targetSw, destSw,
                           currNeighbors, nextHops, nextId);
-                if ((revoke && !displayNextHops.isEmpty())
-                        || (!revoke && !displayNextHops.equals(currNeighbors))) {
+                if ((revoke && !nextHops.isEmpty())
+                        || (!revoke && !nextHops.equals(currNeighbors))) {
                     log.warn("Simple next objective cannot be edited to "
                             + "move from {} to {}", currNeighbors, nextHops);
                 }
                 continue;
             }
 
-            if (currNeighbors == null || nextHops == null) {
-                log.warn("fixing hash groups but found currNeighbors:{} or nextHops:{}"
-                        + " in targetSw:{} for dstSw:{}", currNeighbors, nextHops,
-                        targetSw, destSw);
-                success &= false;
-                continue;
-            }
-
             Set<DeviceId> diff;
             if (revoke) {
                 diff = Sets.difference(currNeighbors, nextHops);