Bug 3039 - PUT augmentNode like last path element
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / rest / impl / XmlNormalizedNodeBodyReader.java
index d2c75f7e0ccfb6b8f4d82d78e7ea0b0a1e0c7971..1933c91e6bd65d210c3b5cf0375f2c4460eb6db3 100644 (file)
@@ -142,6 +142,10 @@ public class XmlNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsPro
 
         if (isPost()) {
             final Deque<Object> foundSchemaNodes = findPathToSchemaNodeByName(schemaNode, docRootElm);
+            if (foundSchemaNodes.isEmpty()) {
+                throw new IllegalStateException(String.format("Child \"%s\" was not found in parent schema node \"%s\"",
+                        docRootElm, schemaNode.getQName()));
+            }
             while (!foundSchemaNodes.isEmpty()) {
                 final Object child  = foundSchemaNodes.pop();
                 if (child instanceof AugmentationSchema) {