Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-345

Mapping service - xml to java object -throws Class cast when the Boolean object and enum

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Won't Do
    • None
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 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
      at org.opendaylight.yang.gen.v1.urn.onf.of111.config.yang.rev111207.ofporttype.Configuration$Broker$Codec$DOM.fromDomStatic(Configuration$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)

      Can anyone tell me how to do? Thanks for help.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            hur1981830@gmail.com rui.hu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: