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

NPE when reading an object generated from a choice statement

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • None
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 4520

    Description

      Trying to get an object generated from a choice statement including both leaf and container results in a NPE. I'm not 100% sure that the NPE is caused by the combination of leaf and container, but there it is. The model used resembles the following:

      grouping object {
      choice type {
      leaf simple-type

      { type int; }

      container complex-type

      { uses some-grouping; }

      }
      }

      Real version at [1].

      The object grouping is used as the input for an RPC. When trying to call RPCInput.getObject().getType() the NPE is thrown. Same result if the grouping is used for RESTCONF input, when reading the generated objects. Here are the relevant first few lines (based on the real model):

      java.lang.NullPointerException
      at org.opendaylight.yangtools.binding.data.codec.impl.ChoiceNodeCodecContext.deserialize(ChoiceNodeCodecContext.java:157)
      at org.opendaylight.yangtools.binding.data.codec.impl.ChoiceNodeCodecContext.deserializeObject(ChoiceNodeCodecContext.java:169)
      at org.opendaylight.yangtools.binding.data.codec.impl.DataObjectCodecContext.getBindingChildValue(DataObjectCodecContext.java:329)
      at org.opendaylight.yangtools.binding.data.codec.impl.LazyDataObject.getBindingData(LazyDataObject.java:122)
      at org.opendaylight.yangtools.binding.data.codec.impl.LazyDataObject.invoke(LazyDataObject.java:69)
      at com.sun.proxy.$Proxy81.getAddress(Unknown Source)
      at org.opendaylight.lispflowmapping.implementation.MappingService.addKey(MappingService.java:140)

      [1] https://git.opendaylight.org/gerrit/gitweb?p=lispflowmapping.git;a=blob;f=mappingservice/lisp-proto/src/main/yang/lisp-address-types.yang;h=a2ba43c8eb669e1f1bd52e14772ea546392c1909;hb=refs/heads/topic/ietf_yang

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            ljakab Lori Jakab
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: