summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-09-14 14:49:56 +0200
committerMarek Gradzki <mgradzki@cisco.com>2016-09-14 14:57:59 +0200
commitd8489c4d78acba2ed6b470df564c5ed2e740422a (patch)
tree9ef3d6864fbeae9a64297cf826a4e0b486e20a40 /v3po/v3po2vpp/src/main/java
parent4053837b4e542470afeb96f09c40370e9903b2c6 (diff)
Fix ClassifySession read NPE when NodeContext is missing
Change-Id: Ieca5ad125df5f26f82351871a0238e65be3e300c Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main/java')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManagerImpl.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManagerImpl.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManagerImpl.java
index 9f61ab021..e1bf50107 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManagerImpl.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManagerImpl.java
@@ -28,6 +28,7 @@ import io.fd.honeycomb.translate.read.ReaderFactory;
import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
import io.fd.honeycomb.translate.util.RWUtils;
import io.fd.honeycomb.translate.util.read.BindingBrokerReader;
+import java.util.List;
import java.util.stream.Collector;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -149,7 +150,11 @@ public final class VppClassifierContextManagerImpl implements VppClassifierConte
}
final String tableName = getTableName(tableIndex, ctx);
final Optional<ClassifyTableContext> tableCtx = ctx.read(getMappingIid(tableName));
- return Optional.fromNullable(tableCtx.get().getNodeContext().stream()
+ final List<NodeContext> nodeContext = tableCtx.get().getNodeContext();
+ if (nodeContext == null) {
+ return Optional.absent();
+ }
+ return Optional.fromNullable(nodeContext.stream()
.filter(n -> n.getIndex().equals(nodeIndex))
.findFirst()
.map(nodes -> nodes.getName())