package org.opendaylight.controller.cluster.datastore.node;
-import com.google.common.base.Preconditions;
+
import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
parentPath = "";
}
- Preconditions.checkArgument(normalizedNode!=null);
-
- navigateNormalizedNode(0, parentPath,normalizedNode, builderRoot);
- // here we need to put back the Node Tree in Container
NormalizedNodeMessages.Container.Builder containerBuilder =
NormalizedNodeMessages.Container.newBuilder();
- containerBuilder.setParentPath(parentPath).setNormalizedNode(
- builderRoot.build());
- container = containerBuilder.build();
+
+ if(normalizedNode != null) {
+
+ navigateNormalizedNode(0, parentPath, normalizedNode, builderRoot);
+ // here we need to put back the Node Tree in Container
+
+ container= containerBuilder.setParentPath(parentPath).setNormalizedNode(
+ builderRoot.build()).build();
+ }else {
+ //this can happen when an attempt was made to read from datastore and normalized node was null.
+ container = containerBuilder.setParentPath(parentPath).build();
+
+ }
}
builderParent.setPath(dataContainerNode.getIdentifier().toString())
.setType(type);
- final Iterable<DataContainerChild<? extends InstanceIdentifier.PathArgument, ?>> value =
+ final Iterable<DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> value =
dataContainerNode.getValue();
for (NormalizedNode<?, ?> node : value) {
Node.Builder builderChild = Node.newBuilder();