Bug 2983 - POST operation to list only accepts data for keys 95/18895/9
authorJan Hajnar <jhajnar@cisco.com>
Thu, 23 Apr 2015 07:15:43 +0000 (09:15 +0200)
committerJan Hajnar <jhajnar@cisco.com>
Wed, 6 May 2015 06:54:26 +0000 (06:54 +0000)
* added catch for ResultAlreadySetException in JsonNormalizedNodeBodyReader

Change-Id: I07d8b8b63e5c2de84b0ee7ec66013d38c58c7b49
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonNormalizedNodeBodyReader.java

index 3be247a..5d63c9c 100644 (file)
@@ -36,6 +36,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStre
 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.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;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
@@ -106,6 +107,11 @@ public class JsonNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsPr
             return new NormalizedNodeContext(path,result);
         } catch (final RestconfDocumentedException e) {
             throw e;
             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);
 
         } catch (final Exception e) {
             LOG.debug("Error parsing json input", e);
 

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.