You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Henri van den bulk (JIRA)" <ax...@ws.apache.org> on 2008/03/19 13:48:24 UTC
[jira] Created: (AXIS-2733) Nullpointer exception when using
xsd:token on a simpleType
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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org
Re: [jira] Created: (AXIS-2733) Nullpointer exception when using xsd:token on a simpleType
Posted by Martin Gainty <mg...@hotmail.com>.
Goddag Henri-
//AXIS 2.1.1 org.apache.axis2.wsdl.codegen.emitter.CTypeInfo.java
// xsd:token
CTypeInfo.addTypemapping(XSD_TOKEN, Token.class.getName())
//AXIS 2.1.3 org.apache.axis2.wsdl.codegen.emitter.CTypeInfo.java
CTypeInfo.addTypemapping(XSD_STRING,"axis2_char_t*");
// xsd:token
CTypeInfo.addTypemapping(XSD_TOKEN, "axis2_char_t*");
//whereas
/util/include/axutil_utils_defines.h contains the definition
typedef char axis2_char_t;
so xsd:token in AXIS-2.13 effectively maps to char *
Please confirm
Bedankt
Martin--
----- Original Message -----
From: "Henri van den bulk (JIRA)" <ax...@ws.apache.org>
To: <ax...@ws.apache.org>
Sent: Wednesday, March 19, 2008 7:48 AM
Subject: [jira] Created: (AXIS-2733) Nullpointer exception when using
xsd:token on a simpleType
> 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: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org