[YANGTOOLS-577] Issue in casting a anyxml leaf to anyXMLNode type Created: 26/Jan/16 Updated: 10/Apr/22 Resolved: 19/Jul/16 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Ambika Prasad Tripathy | Assignee: | Igor Foltin |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| External issue ID: | 5099 |
| Description |
|
I am getting WARNING when trying to get values of datastore-contents-xml anyxml node for below notification. Is there any modification to anyXML implementation? How to convert anyxml data to a DOMSource in current implementation? NOTE: It was working fine during Dec time line. The value I am getting for below notification looks 2016-01-26 15:58:47,021 | WARN | oupCloseable-5-2 | YangpushDOMNotificationListener | 247 - org.opendaylight.yang-push.yangpush-impl - 1.1.0.SNAPSHOT | java.lang.ClassCastException: org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder$ImmutableLeafNode cannot be cast to org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode Notification schema: leaf time-of-update { type yang:date-and-time; } choice encoding { case encode-json { } Sample code: catch (Exception e) { LOG.warn(e.toString()); } String notificationAsString = domSourceToString(domSource); |
| Comments |
| Comment by Tony Tkacik [ 27/Jan/16 ] |
|
Which branch are you observing this issue? |
| Comment by Ambika Prasad Tripathy [ 27/Jan/16 ] |
|
I am downloading from latest repo. |
| Comment by Ambika Prasad Tripathy [ 11/May/16 ] |
|
Would you link to update the release plan for the bug and work arround? |
| Comment by Ambika Prasad Tripathy [ 07/Jun/16 ] |
|
for anyxml node, it is not mandatory to define a schema node. I can put any XML data inside it for which schema may not present. Why the current implementation of anyXML depends on schema? is the schema is not there, how to get DOMSource from the ANYXML leaf node? |
| Comment by Igor Foltin [ 13/Jun/16 ] |
|
Hello Ambika, I would like to ask: How did you construct the DOMNotification object ? Which implementation did you use ? According to the ClassCastException message, it seems like you put a LeafNode under the ChoiceNode "encoding". |
| Comment by Ambika Prasad Tripathy [ 13/Jun/16 ] |
|
Hi, my choice node is like below The notification generated by Device and received by ODL. I am getting proper notification message from device. But when extracting "datastore-contents-xml" node contents, i am facing the issue. br, |
| Comment by Igor Foltin [ 13/Jun/16 ] |
|
Could you please provide more info about the exact conditions under which you ran into this problem ? I will then try to reproduce it. |
| Comment by Ryan Goulding [ 05/Jul/16 ] |
|
Hi Ambika, Have you gotten a chance to provide any more information to reproduce this issue? Thanks, |
| Comment by Ambika Prasad Tripathy [ 07/Jul/16 ] |
|
Hi, Sorry. I missed last notification. If you look my model for anyxml use, i have no predefined schema assigned for the anyxml data node. I am expecting this node to handle all different kind of data tree (any namespaces) received from device. say in first notification message i can expect interface module data tree populated in node datastore-contents-xml and in second notification message it can be QoS module data tree. choice encoding { So, during design time, i have no idea which schema to assign for anyxml. This feature was working fine post beryllium release. br, |
| Comment by Igor Foltin [ 13/Jul/16 ] |
|
Hi Ambika, you need to have a schema assigned just for the anyxml element itself, not for its contents. Moreover, I still do not have enough info to reproduce the issue. Maybe you could upload a patch with a unit test which would show how exactly does the issue occur. Thanks, Igor |
| Comment by Ryan Goulding [ 19/Jul/16 ] |
|
Casting a leaf as anyxml is not supported. If you have further information to provide, please add a comment and we can re-open this bug. |