[YANGTOOLS-345] Mapping service - xml to java object -throws Class cast when the Boolean object and enum Created: 22/Oct/14 Updated: 10/Apr/22 Resolved: 18/Mar/15 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | rui.hu | Assignee: | Unassigned |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| Attachments: |
|
| External issue ID: | 2238 |
| Description |
|
I use BindingIndependentMappingService's dataObjectFromDataDom method to convert a CompositeNode object into a Binding aware of the object, but encountered one problem:(i use of-conf yang model), Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to org.opendaylight.yang.gen.v1.urn.onf.of111.config.yang.rev111207.OFPortOtherFeatureListType$Medium at org.opendaylight.yang.gen.v1.urn.onf.of111.config.yang.rev111207.ofporttype.features.Advertised$Broker$Codec$DOM.fromDomStatic(Advertised$Broker$Codec$DOM.java) at org.opendaylight.yang.gen.v1.urn.onf.of111.config.yang.rev111207.ofporttype.Features$Broker$Codec$DOM.fromDomStatic(Features$Broker$Codec$DOM.java) at org.opendaylight.yang.gen.v1.urn.onf.of111.config.yang.rev111207.capable.switch.resources.Port$Broker$Codec$DOM.fromDomStatic(Port$Broker$Codec$DOM.java) at org.opendaylight.yang.gen.v1.urn.onf.of111.config.yang.rev111207.capable.switch.Resources$Broker$Codec$DOM.fromDomStatic(Resources$Broker$Codec$DOM.java) at org.opendaylight.yang.gen.v1.urn.onf.of111.config.yang.rev111207.CapableSwitch$Broker$Codec$DOM.fromDomStatic(CapableSwitch$Broker$Codec$DOM.java) at org.opendaylight.yang.gen.v1.urn.onf.of111.config.yang.rev111207.CapableSwitch$Broker$Codec$DOM.deserialize(CapableSwitch$Broker$Codec$DOM.java) at org.opendaylight.yangtools.sal.binding.generator.impl.LazyGeneratedCodecRegistry$DataContainerCodecImpl.deserialize(LazyGeneratedCodecRegistry.java:573) at org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl.dataObjectFromDataDom(RuntimeGeneratedMappingServiceImpl.java:291) ... 7 more I looked at dynamically generated code, find the following code? boolean hasNext = _iterator.hasNext(); while(hasNext) { isempty = false; Object listItem = _iterator.next(); if(listItem instanceof java.util.Map.Entry) { Object innerValue = ((java.util.Map.Entry) _listItem).getValue(); Object _value = (org.opendaylight.yang.gen.v1.urn.onf.of111.config.yang.rev111207.OFPortOtherFeatureListType$Medium) _innerValue; getMedium.add(value); }_hasNext = _iterator.hasNext(); } } and Boolean Object Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean Can anyone tell me how to do? Thanks for help. |
| Comments |
| Comment by rui.hu [ 22/Oct/14 ] |
|
yang tools version is 0.7.0-SNAPSHOT |
| Comment by Jan Hajnar [ 13/Nov/14 ] |
|
Hi, Could you please provide a yang module or paste parts of that module which cause reported errors? Thanks, |
| Comment by rui.hu [ 01/Dec/14 ] |
|
Attachment of-config.yang has been added with description: of-conf yang model |
| Comment by rui.hu [ 01/Dec/14 ] |
|
Attachment xml fragment.xml has been added with description: parse xml content |
| Comment by Jan Hajnar [ 17/Dec/14 ] |
|
Hi, Thanks for the test files. The bug is happening for me and is still present in latest stable helium branch. Problem seems to be in TransformerGenerator class. Giving back to pool as I will not be able to fix this now. |
| Comment by Tony Tkacik [ 18/Mar/15 ] |
|
Service is deprecated and to be removed in Lithium, please use binding-data-codec, |