Fixing NPE with null old description in NetconfDeviceProvider
Change-Id: Iece29a0a0ed3d2c72e64137e7e0dc1306e69f5eb
diff --git a/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java b/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java
index a0626df..9f1a6c4 100644
--- a/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java
+++ b/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java
@@ -677,10 +677,15 @@
private class InternalDeviceListener implements DeviceListener {
@Override
public void event(DeviceEvent event) {
- DeviceId deviceId = event.subject().id();
+ Device device = event.subject();
+ DeviceId deviceId = device.id();
if (event.type() == DeviceEvent.Type.DEVICE_ADDED && !deviceService.isAvailable(event.subject().id())) {
try {
- checkAndUpdateDevice(deviceId, null, true);
+ DeviceDescription description = new DefaultDeviceDescription(deviceId.uri(), device.type(),
+ device.manufacturer(), device.hwVersion(), device.swVersion(),
+ device.serialNumber(), device.chassisId(),
+ (SparseAnnotations) device.annotations());
+ checkAndUpdateDevice(deviceId, description, true);
} catch (Exception e) {
log.error("Unhandled exception checking {}", deviceId, e);
}