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

code generator should not generate this.value = null

    XMLWordPrintable

Details

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

    • 1276

    Description

      org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress

      public IpAddress(Ipv4Address _ipv4Address)

      { super(); this._ipv4Address = _ipv4Address; this._ipv6Address = null; this._value = null; }

      This constructor is possibly wrong because it returns null on getValue(). If the instance is created using this constructor it cannot be sent over JMX.

      Consider this example:
      client.setAddress(new IpAddress(new Ipv4Address("127.0.0.1")));
      will fail
      client.setAddress(new IpAddress("127.0.0.1".toCharArray()));
      will succeed (value != null)

      Proposed fix: _value should be filled using _ipv4Address.getValue()

      Detail:

      The failure looks like this:
      Caused by: java.io.InvalidObjectException: Exception constructing org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress
      at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory.invalidObjectException(DefaultMXBeanMappingFactory.java:1415)
      at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeBuilderViaConstructor.fromCompositeData(DefaultMXBeanMappingFactory.java:1335)
      at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeMapping.fromNonNullOpenValue(DefaultMXBeanMappingFactory.java:918)
      at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$NonNullMXBeanMapping.fromOpenValue(DefaultMXBeanMappingFactory.java:132)
      at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeBuilderViaSetters.fromCompositeData(DefaultMXBeanMappingFactory.java:1119)
      ... 48 more
      Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeBuilderViaConstructor.fromCompositeData(DefaultMXBeanMappingFactory.java:1331)
      ... 51 more
      Caused by: java.lang.NullPointerException
      at java.lang.String.<init>(String.java:168)
      at org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress.<init>(IpAddress.java:38)
      ... 56 more

      Attachments

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

        Activity

          People

            mvitez@cisco.com Martin Vitez
            tolvecky@cisco.com Tomas Olvecky
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: