Generated classes for SimpleType has base of dateTime result in wrong serialization/deserialization if that type is used as attribute. ---------------------------------------------------------------------------------------------------------------------------------------
Key: AXIS2-3764 URL: https://issues.apache.org/jira/browse/AXIS2-3764 Project: Axis 2.0 (Axis2) Issue Type: Bug Components: codegen Affects Versions: 1.3 Environment: Eclipse 3.3, axis2 1.3 , java 6. Reporter: Milos Ratkovic Priority: Minor SimpleType has base of dateTime when used as attribute generates following serialization : datumVreme="java.util.GregorianCalendar[time=1209044290989,areFieldsSet=true, ... Parser expects this format (ConverterUtil : convertToDateTime): // '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (Z)? Example : wsdl : ... <xsd:simpleType name="DatumVreme"> <xsd:restriction base="xsd:dateTime" /> </xsd:simpleType> <xsd:element name="InOut"> <xsd:complexType> <xsd:sequence> <xsd:element name="in" type="xsd:string"/> </xsd:sequence> <xsd:attribute name="datumVreme" type="tns:DatumVreme" /> </xsd:complexType> </xsd:element> ... Exception: Exception in thread "main" java.lang.NumberFormatException: in valid time zone attribute at org.apache.axis2.databinding.utils.ConverterUtil.convertToDateTime(ConverterUtil.java:609) at org.example.www.testdatetime.DatumVreme$Factory.fromString(DatumVreme.java:309) at org.example.www.testdatetime.InOut$Factory.parse(InOut.java:436) at org.example.www.testdatetime.Test.main(Test.java:42) Generated code : InOut : public void serialize(final javax.xml.namespace.QName parentQName, ... writeAttribute("", "datumVreme", localDatumVreme.toString(), xmlWriter); ... public static InOut parse(javax.xml.stream.XMLStreamReader reader) ... object.setDatumVreme(org.example.www.testdatetime.DatumVreme.Factory.fromString( tempAttribDatumVreme, "")); ... DatumVreme: protected java.util.Calendar localDatumVreme; public java.lang.String toString() { return localDatumVreme.toString(); // java.util.GregorianCalendar[time=1209044290989,areFieldsSet=true, .... } ... public static class Factory { public static DatumVreme fromString(java.lang.String value, ... returnValue.setDatumVreme(org.apache.axis2.databinding.utils.ConverterUtil.convertToDateTime( value)); ... My workaround is to change toString method in generated class: public java.lang.String toString() { //return localDatumVreme.toString(); return org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDatumVreme); } So I guess fix could be to change code generation for toString method. There is possibility for similar behavior in case of other based types. -- 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]