Uploaded image for project: 'Axis'
  1. Axis
  2. AXIS-2733

Nullpointer exception when using xsd:token on a simpleType

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.4
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Mac Os, Solaris

      Description

      When using a WSDL that has a message with an element that uses a simpleContent with a restriction base of type xsd:token, see below. The class that WSDL2JAVA generates has a constructor that accepts a Token. This is a correct generated class. However, during deserialization of the response message the SAX handler throws a Null Pointer exception as it's trying to look a constructor on that class of type String.

      ... Snippet of complexType
      <xsd:complexType name="ItemTypeCodeType">
      <xsd:annotation>
      <xsd:documentation xml:lang="en">
      Item types supported by Cradle
      </xsd:documentation>
      </xsd:annotation>
      <xsd:simpleContent>
      <xsd:extension base="tns:ItemTypeCodeContentType">
      <xsd:attribute name="infoID" type="xsd:int">
      <xsd:annotation>
      <xsd:documentation xml:lang="en">
      values
      </xsd:documentation>
      </xsd:annotation>
      </xsd:attribute>
      </xsd:extension>
      </xsd:simpleContent>
      </xsd:complexType>

      <xsd:simpleType name="ItemTypeCodeContentType">
      <xsd:restriction base="xsd:token">
      <xsd:enumeration value="NULL">
      <xsd:annotation>
      <xsd:documentation xml:lang="en">
      Invalid item type.
      </xsd:documentation>
      </xsd:annotation>
      </xsd:enumeration>
      </xsd:restriction>
      </xsd:simpleType>

      – Constructor that gets generated:

      // Simple Types must have a String constructor
      public ItemTypeCodeType(org.apache.axis.types.Token _value)

      { super(_value); }

      – To Fix the issue the class created should have a constructor that accepts a String as well and generate a token from that:

      // FIX because tokens are not simple...
      public ItemTypeCodeType(String _value) { super(_value); }

      // Constructor
      protected ItemTypeCodeContentType(org.apache.axis.types.Token value)

      { _value_ = value; _table_.put(_value_,this); }

      //FIX
      protected ItemTypeCodeContentType(String value)

      { _value_ = new org.apache.axis.types.Token(value); _table_.put(_value_,this); }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              hvandenb Henri van den bulk
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: