[CONTROLLER-267] ClassCastException for instance-identifier in leafref Created: 02/Apr/14  Updated: 25/Jul/23  Resolved: 30/Apr/14

Status: Resolved
Project: controller
Component/s: restconf
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Martin Sunal Assignee: Jozef Gloncak
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Windows
Platform: PC


External issue ID: 652
Priority: High

 Description   

grouping someGrouping {
container someContainer {
leaf someLeaf

{ type instance-identifier; }

}
}

rpc make-foo {
input {
leaf qs {
type leafref

{ path "../../../someGrouping/someContainer/someLeaf"; }

}
}
output {
leaf result

{ type string; }

}
}

I invoke RPC with this input:
<input>
<qs xmlns:np="namespaceOfSomeModule">/np:foo/np:bar[np:name="someValue"]</qs>
</input>

ERROR o.o.c.sal.restconf.impl.RestCodec - ClassCastException was thrown when codec is invoked with parameter
java.lang.ClassCastException: org.opendaylight.controller.sal.restconf.impl.IdentityValuesDTO cannot be cast to java.lang.String
at org.opendaylight.controller.sal.restconf.impl.RestCodec$LeafrefCodecImpl.deserialize(RestCodec.java:183) ~[bundlefile:na]
at org.opendaylight.controller.sal.restconf.impl.RestCodec$ObjectCodec.deserialize(RestCodec.java:92) ~[bundlefile:na]
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.normalizeNode(RestconfImpl.java:1353) [bundlefile:na]
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.normalizeNode(RestconfImpl.java:1289) [bundlefile:na]
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.normalizeNode(RestconfImpl.java:1196) [bundlefile:na]
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.callRpc(RestconfImpl.java:613) [bundlefile:na]
at org.opendaylight.controller.sal.restconf.impl.RestconfImpl.invokeRpc(RestconfImpl.java:566) [bundlefile:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_51]



 Comments   
Comment by Jozef Gloncak [ 23/Apr/14 ]

investigating

Comment by Jozef Gloncak [ 23/Apr/14 ]

By default if input data were in format for which it was possible to parse as
XPath if was done like this.
It caused that for leafref which indexed to
instance-identifier the value was parsed as XPath and not as string (codec is written to except String at input).

Patch was prepared:
https://git.opendaylight.org/gerrit/#/c/6335/

Comment by Jozef Gloncak [ 30/Apr/14 ]

Merged on 28APR2014

Generated at Wed Feb 07 19:52:36 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.