BUG-4982: NPE in LocRibWriter when removing a route 22/32922/1
authorClaudio D. Gasparini <cgaspari@cisco.com>
Mon, 18 Jan 2016 10:30:12 +0000 (11:30 +0100)
committerMilos Fabian <milfabia@cisco.com>
Mon, 18 Jan 2016 11:26:21 +0000 (11:26 +0000)
Fix by check wheter entry is null.

Change-Id: I4d464e8bdb0ff0e4bbaeeb19f4ad46745b67d367
Signed-off-by: Claudio D. Gasparini <cgaspari@cisco.com>
(cherry picked from commit 86a47d69e05d776bc4b049600a10c257300ff125)

bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/LocRibWriter.java

index 981307e1acce4119c4a698145d67d167696ea904..c517212c754f55df30d6fb554d8fcfa6910ee193 100644 (file)
@@ -303,11 +303,12 @@ final class LocRibWriter implements AutoCloseable, DOMDataTreeChangeListener {
          * if we have two eBGP peers, for example, there is no reason why we should perform the translation
          * multiple times.
          */
+        final ContainerNode attributes = entry == null ? null : entry.attributes();
         for (final PeerRole role : PeerRole.values()) {
             final PeerExportGroup peerGroup = this.peerPolicyTracker.getPeerGroup(role);
             if (peerGroup != null) {
                 final PeerId peerId = key.getPeerId();
-                final ContainerNode effectiveAttributes = peerGroup.effectiveAttributes(peerId, entry.attributes());
+                final ContainerNode effectiveAttributes = peerGroup.effectiveAttributes(peerId, attributes);
                 if (effectiveAttributes != null) {
                     for (final Entry<PeerId, YangInstanceIdentifier> pid : peerGroup.getPeers()) {
                         if (!peerId.equals(pid.getKey()) && isTableSupported(pid.getKey())) {