Nullpointer exception when using xsd:token on a simpleType
----------------------------------------------------------

                 Key: AXIS-2733
                 URL: https://issues.apache.org/jira/browse/AXIS-2733
             Project: Axis
          Issue Type: Bug
          Components: Serialization/Deserialization
    Affects Versions: 1.4
         Environment: Mac Os, Solaris
            Reporter: Henri van den bulk


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);
    } 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to