[jboss-jira] [JBoss JIRA] Commented: (JBXB-99) marshalDate appends timezone

Jason T. Greene (JIRA) jira-events at lists.jboss.org
Mon Mar 26 11:24:54 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBXB-99?page=comments#action_12357319 ] 
            
Jason T. Greene commented on JBXB-99:
-------------------------------------

The JAXB spec does not limit to 8601. Although the schema date type is based off of 8601. The only direct reference to 8601 from the JAXB spec is to the @Generated annotation which doesn't relate to schema types. JAXB just marshalls/unmarshalls according to the defined schema type. The preferred mapping for xsd:date (without customization) is XMLGregorianCalendar. XMLGregorianCalendar can either include or exclude the timezone information depending on how it is constructed. http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/datatype/DatatypeFactory.html#newXMLGregorianCalendarDate(int,%20int,%20int,%20int).

I am going to change the description to be an unmarshalling bug

-Jason

> marshalDate appends timezone
> ----------------------------
>
>                 Key: JBXB-99
>                 URL: http://jira.jboss.com/jira/browse/JBXB-99
>             Project: JBoss XML Binding (JBossXB)
>          Issue Type: Bug
>    Affects Versions: JBossXB-1.0.0.CR9
>            Reporter: Thomas Diesler
>
>    /**
>     * [-]yyyy-mm-dd
>     *
>     * @param value string date value
>     * @return equivalent date as an instance of java.util.Calendar.
>     */
>    public static String marshalDate(Calendar value)
>    {
>       String result = String.valueOf(value.get(Calendar.YEAR));
>       result += '-';
>       result += marshalInt(value.get(Calendar.MONTH) + 1, 2);
>       result += '-';
>       result += marshalInt(value.get(Calendar.DAY_OF_MONTH), 2);
>       result += marshalTimeZone(value);
>       return result;
>    }
> Given these CTS calendars 
>     public final static GregorianCalendar GregorianCalendar_data[] = {
> 	new GregorianCalendar(6,5,1,10,0,0),
> 	new GregorianCalendar(9,10,25,1,30,0),
> 	new GregorianCalendar(96,5,1,2,0,30),
> 	new GregorianCalendar(99,10,25,3,15,15),
> 	new GregorianCalendar(996,5,1,6,6,6),
> 	new GregorianCalendar(999,10,25,7,7,7),
> 	new GregorianCalendar(1996,5,1,8,8,8),
> 	new GregorianCalendar(1999,10,25,9,9,9),
> 	null
>     };
> jbossxb generates a string that cannot be parsed on the server side
> 12:12:36,027 ERROR [SOAPFaultHelperJAXRPC] SOAP request exception
> org.jboss.xb.binding.JBossXBValueFormatException: Date value does not follow the format '-'? yyyy '-' mm '-' dd: 6-06-01-05:00
>         at org.jboss.xb.binding.SimpleTypeBindings.parseDate(SimpleTypeBindings.java:2088)
>         at org.jboss.xb.binding.SimpleTypeBindings.unmarshalDate(SimpleTypeBindings.java:1701)
>         at org.jboss.ws.core.jaxrpc.binding.CalendarDeserializer.deserialize(CalendarDeserializer.java:61)
>         at org.jboss.ws.core.jaxrpc.binding.CalendarDeserializer.deserialize(CalendarDeserializer.java:47)
>         at org.jboss.ws.core.soap.XMLContent.unmarshallObjectContents(XMLContent.java:175)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list