fixing bug that would not let device come back online

Change-Id: Ie2cc9c35159320d5abab0b38984baecc2928b00e
diff --git a/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java b/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
index 973db49..687762e 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
@@ -427,6 +427,7 @@
 
         // Primary providers can respond to all changes, but ancillary ones
         // should respond only to annotation changes.
+        DeviceEvent event = null;
         if ((providerId.isAncillary() && annotationsChanged) ||
                 (!providerId.isAncillary() && (propertiesChanged || annotationsChanged))) {
             boolean replaced = devices.replace(newDevice.id(), oldDevice, newDevice);
@@ -436,17 +437,18 @@
                        providerId, oldDevice, devices.get(newDevice.id())
                         , newDevice);
             }
-            if (!providerId.isAncillary()) {
-                boolean wasOnline = availableDevices.contains(newDevice.id());
-                markOnline(newDevice.id(), newTimestamp);
-                if (!wasOnline) {
-                    notifyDelegateIfNotNull(new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, newDevice, null));
-                }
-            }
 
-            return new DeviceEvent(DeviceEvent.Type.DEVICE_UPDATED, newDevice, null);
+            event = new DeviceEvent(DeviceEvent.Type.DEVICE_UPDATED, newDevice, null);
         }
-        return null;
+
+        if (!providerId.isAncillary()) {
+            boolean wasOnline = availableDevices.contains(newDevice.id());
+            markOnline(newDevice.id(), newTimestamp);
+            if (!wasOnline) {
+                notifyDelegateIfNotNull(new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, newDevice, null));
+            }
+        }
+        return event;
     }
 
     @Override