Remove a blind cast 63/96963/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 20 Jul 2021 18:48:05 +0000 (20:48 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 20 Jul 2021 18:48:05 +0000 (20:48 +0200)
We have a null check here, let's use an instanceof check instead,
which is essentially the same thing, except more type-safe.

Change-Id: I2538e4e2f58513aa51bcefe26d4e55ad8ab59283
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/LinkstateGraphBuilder.java

index c39fc0a448fc016c5472a05bec5150f3f996dbdf..5e1f1e530b8b94e98c8b7ac7bfcd73f6e61cfc25 100644 (file)
@@ -507,7 +507,7 @@ public class LinkstateGraphBuilder extends AbstractTopologyBuilder<LinkstateRout
         final Attributes1 attr = attributes.augmentation(Attributes1.class);
         if (attr != null) {
             final LinkStateAttribute attrType = attr.getLinkStateAttribute();
-            if (attrType != null) {
+            if (attrType instanceof PrefixAttributesCase) {
                 pa = ((PrefixAttributesCase) attrType).getPrefixAttributes();
             } else {
                 LOG.warn("Missing attribute type in IP {} prefix {} route {}, skipping it", ippfx, prefixCase, value);