commit | ab2c8d81b2254e99f108e37acfdfdc2e7a446a15 | [log] [tgz] |
---|---|---|
author | David K. Bainbridge <dbainbri@ciena.com> | Wed Nov 07 11:43:43 2018 -0800 |
committer | David K. Bainbridge <dbainbri@ciena.com> | Wed Nov 07 11:43:43 2018 -0800 |
tree | 0e9df6b1c19a0e26cafdd45eaa47b1eebd88f431 | |
parent | 2df491826759a8693f80c69d48d20b2618f08182 [diff] |
check if a value in a map exists before dereference, avoid NPE Change-Id: I9f5ef22e1fa5105cd9c1ee0d0a0b15c98f5a1abf
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 8281f4e..1a37be5 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
@@ -457,8 +457,9 @@ if (isReachable && deviceService.isAvailable(deviceId) && mastershipService.isLocalMaster(deviceId)) { //if ports are not discovered, retry the discovery + AtomicInteger count = retriedPortDiscoveryMap.get(deviceId); if (deviceService.getPorts(deviceId).isEmpty() && - retriedPortDiscoveryMap.get(deviceId).getAndIncrement() < maxRetries) { + count != null && count.getAndIncrement() < maxRetries) { discoverPorts(deviceId); } updatePortStatistics(device);