When we encounter a wrong nested child we end up throwing an opaque
ClassCastException. Add an explicit check to improve diagnostics.
JIRA: NETCONF-820
Change-Id: I3c5a24c1ff4d12a56dfd5fd6d8cd3f940af330a0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
5ca9d3ee04aa5464f81be533f8b4d9b675e7da96)
AbstractMapMixin(final ListSchemaNode list) {
super(NodeIdentifier.create(list.getQName()));
AbstractMapMixin(final ListSchemaNode list) {
super(NodeIdentifier.create(list.getQName()));
- this.innerNode = new ListEntry(NodeIdentifierWithPredicates.of(list.getQName()), list);
- this.keyLeaves = list.getKeyDefinition();
+ innerNode = new ListEntry(NodeIdentifierWithPredicates.of(list.getQName()), list);
+ keyLeaves = list.getKeyDefinition();
@Override
final void emitChildTreeNode(final NormalizedNodeStreamWriter writer, final PathNode node) throws IOException {
@Override
final void emitChildTreeNode(final NormalizedNodeStreamWriter writer, final PathNode node) throws IOException {
- final NodeIdentifierWithPredicates childPath = (NodeIdentifierWithPredicates) node.element();
+ final PathArgument element = node.element();
+ if (!(element instanceof NodeIdentifierWithPredicates)) {
+ throw new IOException("Child identifier " + element + " is invalid in parent " + getIdentifier());
+ }
+
+ final NodeIdentifierWithPredicates childPath = (NodeIdentifierWithPredicates) element;
final StreamingContext<?> childOp = getChildOperation(childPath);
if (childPath.size() == 0 && node.isEmpty() || childPath.keySet().containsAll(keyLeaves)) {
// This is a query for the entire list, or the query specifies everything we need
final StreamingContext<?> childOp = getChildOperation(childPath);
if (childPath.size() == 0 && node.isEmpty() || childPath.keySet().containsAll(keyLeaves)) {
// This is a query for the entire list, or the query specifies everything we need
UnkeyedListMixin(final ListSchemaNode list) {
super(NodeIdentifier.create(list.getQName()));
UnkeyedListMixin(final ListSchemaNode list) {
super(NodeIdentifier.create(list.getQName()));
- this.innerNode = new UnkeyedListItem(list);
+ innerNode = new UnkeyedListItem(list);