summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2018-06-21 08:39:59 +0200
committerMarek Gradzki <mgradzki@cisco.com>2018-06-21 08:55:18 +0200
commit940956e1513837842a780152fc1db837afea1864 (patch)
tree3c2d7bffb399407b1e7cbbcd86a07db1de028b69 /v3po/v3po2vpp/src/main
parent1528ed5d01ddd8a0de14711de59861d16f727a3e (diff)
Fix NPE in InterfaceDataTranslator.isInterfaceOfType
SwInterfaceDetails returned by dump manager are nullable. In that case isInterfaceOfType should return false. Change-Id: Iaf3d1f6c6923ed6863357fe2470716f135b6164f Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/InterfaceDataTranslator.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/InterfaceDataTranslator.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/InterfaceDataTranslator.java
index 9f788afc6..75554d4b7 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/InterfaceDataTranslator.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/InterfaceDataTranslator.java
@@ -29,6 +29,7 @@ import java.math.BigInteger;
import java.util.Objects;
import java.util.stream.Collector;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.EthernetCsmacd;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
@@ -177,9 +178,13 @@ public interface InterfaceDataTranslator extends ByteDataTranslator, JvppReplyCo
return isInterfaceOfType(ifcType, vppInterfaceDetails);
}
- default boolean isInterfaceOfType(final Class<? extends InterfaceType> ifcType,
- final SwInterfaceDetails cachedDetails) {
- return ifcType.equals(getInterfaceType(toString(cachedDetails.interfaceName)));
+ default boolean isInterfaceOfType(@Nonnull final Class<? extends InterfaceType> ifcType,
+ @Nullable final SwInterfaceDetails cachedDetails) {
+ if (cachedDetails == null) {
+ return false;
+ } else {
+ return ifcType.equals(getInterfaceType(toString(cachedDetails.interfaceName)));
+ }
}
/**