Merge "Bug 383 - exception raised if key part of URI is incorrect"
authorTony Tkacik <ttkacik@cisco.com>
Mon, 3 Mar 2014 10:41:25 +0000 (10:41 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 3 Mar 2014 10:41:25 +0000 (10:41 +0000)
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.xtend

index 2b9c78bb87a2134313676e0097f47e18ca8bd17e..837d7ae5b7d147b59aa762b1fda4a32de0b86175 100644 (file)
@@ -548,12 +548,18 @@ class ControllerContext implements SchemaContextListener {
         val typedef = (node as LeafSchemaNode).type;
         
         var decoded = TypeDefinitionAwareCodec.from(typedef)?.deserialize(urlDecoded)
+        var additionalInfo = ""
         if(decoded === null) {
             var baseType = RestUtil.resolveBaseTypeFrom(typedef)
             if(baseType instanceof IdentityrefTypeDefinition) {
                 decoded = toQName(urlDecoded)
+                additionalInfo = "For key which is of type identityref it should be in format module_name:identity_name."
             }
         }
+        if (decoded === null) {
+            throw new ResponseException(BAD_REQUEST, uriValue + " from URI can't be resolved. "+  additionalInfo )
+        }                
+        
         map.put(node.QName, decoded);
     }