[ONOS-6910] Handle null device events in createOrUpdateDevice
Change-Id: Ie6e65368ada0bd0dda06b309b7342b7905185c54
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 4dd45a8..a3818c7 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
@@ -321,16 +321,17 @@
synchronized (device) {
deviceEvent = createOrUpdateDeviceInternal(providerId, deviceId, deltaDesc);
+ if (deviceEvent == null) {
+ return null;
+ }
mergedDesc = device.get(providerId).getDeviceDesc();
}
// If this node is the master for the device, update peers.
if (isMaster) {
- if (deviceEvent != null) {
- log.debug("Notifying peers of a device update topology event for providerId: {} and deviceId: {}",
- providerId, deviceId);
- notifyPeers(new InternalDeviceEvent(providerId, deviceId, mergedDesc));
- }
+ log.debug("Notifying peers of a device update topology event for providerId: {} and deviceId: {}",
+ providerId, deviceId);
+ notifyPeers(new InternalDeviceEvent(providerId, deviceId, mergedDesc));
} else {
return null;
}
@@ -1119,7 +1120,7 @@
private boolean isDeviceRemoved(DeviceId deviceId, Timestamp timestampToCheck) {
Timestamp removalTimestamp = removalRequest.get(deviceId);
if (removalTimestamp != null &&
- removalTimestamp.compareTo(timestampToCheck) >= 0) {
+ removalTimestamp.compareTo(timestampToCheck) > 0) {
// removalRequest is more recent
return true;
}