* fixed JsonNormalizedNodeBodyReader error when PUT operation was used
and data were wrapped in augmentation or choice nodes
* fixed bug that allowed XmlNormalizedNodeBodyReader to parse PUT with
incorrect data (when PUT request was written as POST)
note: testet manualy describled scenario + CSIT OFP_test_suite
Change-Id: Ia25b6b45a1154866dea29c763be67cdb17fa0ce1
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
Signed-off-by: Vaclav Demcak <vdemcak@cisco.com>
final List<YangInstanceIdentifier.PathArgument> iiToDataList = new ArrayList<>();
InstanceIdentifierContext<? extends SchemaNode> newIIContext;
final List<YangInstanceIdentifier.PathArgument> iiToDataList = new ArrayList<>();
InstanceIdentifierContext<? extends SchemaNode> newIIContext;
- if (isPost()) {
- while (result instanceof AugmentationNode || result instanceof ChoiceNode) {
- final Object childNode = ((DataContainerNode) result).getValue().iterator().next();
+ while (result instanceof AugmentationNode || result instanceof ChoiceNode) {
+ final Object childNode = ((DataContainerNode) result).getValue().iterator().next();
+ if (isPost()) {
iiToDataList.add(result.getIdentifier());
iiToDataList.add(result.getIdentifier());
- result = (NormalizedNode<?, ?>) childNode;
+ result = (NormalizedNode<?, ?>) childNode;
+ }
+
+ if (isPost()) {
if (result instanceof MapEntryNode) {
iiToDataList.add(new YangInstanceIdentifier.NodeIdentifier(result.getNodeType()));
iiToDataList.add(result.getIdentifier());
if (result instanceof MapEntryNode) {
iiToDataList.add(new YangInstanceIdentifier.NodeIdentifier(result.getNodeType()));
iiToDataList.add(result.getIdentifier());
if (isPost()) {
final Deque<Object> foundSchemaNodes = findPathToSchemaNodeByName(schemaNode, docRootElm);
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) {
while (!foundSchemaNodes.isEmpty()) {
final Object child = foundSchemaNodes.pop();
if (child instanceof AugmentationSchema) {