JBoss Community

Re: jaxb version used by JBoss AS 7.0Final (date issue/timezone issue)

created by Peter Fry in JBoss Web Services - View the full discussion

This only seems to be a problem when using a DateConverter i.e.

 

<bindings version="2.1"
          xmlns="http://java.sun.com/xml/ns/jaxb"
          xmlns:xs="http://www.w3.org/2001/XMLSchema">
          xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
          xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
          xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
  <globalBindings>              
     <javaType name="java.util.Date" xmlType="xs:date"            
           parseMethod="uk.co.abusiness.webservices.DateConverter.parseDate"            
           printMethod="uk.co.abusiness.webservices.DateConverter.printDate"/>          
     <javaType name="java.util.Date" xmlType="xs:time"            
           parseMethod="uk.co.abusiness.webservices.DateConverter.parseTime"            
           printMethod="uk.co.abusiness.webservices.DateConverter.printTime"/>          
     <javaType name="java.util.Date" xmlType="xs:dateTime"            
           parseMethod="uk.co.abusiness.webservices.DateConverter.parseDateTime"            
           printMethod="uk.co.abusiness.webservices.DateConverter.printDateTime"/>
     <serializable uid="1" />
  </globalBindings>
</bindings>

 

And specifically the printDate, printDateTime, printTime methods. Previously we had followed the various suggestions on the internet and implemented:

 

        Calendar cal = new GregorianCalendar();
        cal.setTime( dt );
        return DatatypeConverter.printDateTime( cal );

 

It seemed the calls to DatatypeConverter introduced the problem.

 

Our resolution was to use the JAXB 2.2.1 implementations of the printDate, printDateTime and printTime methods directly/inline (the reference implementation includes the source).

 



Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community