commit | d62297fd47a7768e0349f41b814c064e0586581a | [log] [tgz] |
---|---|---|
author | David K. Bainbridge <dbainbri@ciena.com> | Wed Nov 07 11:43:43 2018 -0800 |
committer | Andrea Campanella <andrea@opennetworking.org> | Thu Nov 08 09:46:35 2018 +0100 |
tree | 78130eb78cc7464ed8e710349c77926b911f8f26 | |
parent | 32b0362b57bc5e90193758f361a28650a924dd39 [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 6264b91..f1a95af 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
@@ -466,8 +466,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);