Issue Description:
=================
Elan instance name may be null, add to ConcurrentHashMap must throw NPE
ERROR | opendaylight-cluster-data-notification-dispatcher-40 |
DataTreeChangeListenerActor | 235 -
org.opendaylight.controller.sal-clustering-commons - 1.9.1 |
member-2-shard-default-config: Error notifying listener
org.opendaylight.genius.mdsalutil.cache.DataObjectCache$$Lambda$1291/
872119028@
32410eae
java.lang.NullPointerException: null
at org.opendaylight.netvirt.elan.cache.ElanInterfaceCache.added(ElanInterfaceCache.java:75)
at org.opendaylight.netvirt.elan.cache.ElanInterfaceCache.added(ElanInterfaceCache.java:37)
Solution:
=========
Determine that the Elan instance name cannot be null before adding
Change-Id: I21f2f93427aec92b708725dd41aa37cd37e7dcac
Signed-off-by: zhangninglc <zhangninglc@inspur.com>
@Override
protected void added(InstanceIdentifier<ElanInterface> path, ElanInterface elanInterface) {
- elanInstanceToInterfacesCache.computeIfAbsent(elanInterface.getElanInstanceName(),
- key -> ConcurrentHashMap.newKeySet()).add(elanInterface.getName());
+ if (null != elanInterface.getElanInstanceName() && null != elanInterface.getName()) {
+ elanInstanceToInterfacesCache.computeIfAbsent(elanInterface.getElanInstanceName(),
+ key -> ConcurrentHashMap.newKeySet()).add(elanInterface.getName());
+ }
}
@Override