import org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter;
import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
+import org.opendaylight.yangtools.yang.data.impl.schema.ResultAlreadySetException;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaNode;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
NormalizedNode<?, ?> partialResult = resultHolder.getResult();
final NormalizedNode<?, ?> result;
- // unwrap result from augmentation and choice nodes on PUT
+ // FIXME: Also II should be updated unwrap result from augmentation and choice nodes on PUT
if (!isPost()) {
while (partialResult instanceof AugmentationNode || partialResult instanceof ChoiceNode) {
final Object childNode = ((DataContainerNode) partialResult).getValue().iterator().next();
}
}
- if (partialResult instanceof MapNode) {
+ if (partialResult instanceof MapNode && !isPost()) {
result = Iterables.getOnlyElement(((MapNode) partialResult).getValue());
} else {
result = partialResult;
}
return new NormalizedNodeContext(path,result);
+ } catch (final RestconfDocumentedException e) {
+ throw e;
+ } catch (final ResultAlreadySetException e) {
+ LOG.debug("Error parsing json input:", e);
+
+ throw new RestconfDocumentedException("Error parsing json input: Failed to create new parse result data. " +
+ "Are you creating multiple resources/subresources in POST request?");
} catch (final Exception e) {
LOG.debug("Error parsing json input", e);