XMLGregorianCalendarImpl converts offset in minutes incorrectly in getTimeZone
------------------------------------------------------------------------------

                 Key: XERCESJ-1243
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1243
             Project: Xerces2-J
          Issue Type: Bug
          Components: JAXP (javax.xml.datatype)
    Affects Versions: 2.9.0
            Reporter: Ted Sanne


When using XMLGregorianCalendarImpl to convert the string 
"2006-11-22T00:00:00.0+01:02" to a GregorianCalendar, the timezone ends up as 
"GMT+12:00".
The following code can be used to reproduce the problem:

String dateTimeString = "2006-11-22T00:00:00.0+01:02";
DatatypeFactoryImpl impl = new DatatypeFactoryImpl();
XMLGregorianCalendar cal = impl.newXMLGregorianCalendar( dateTimeString );

System.out.println( "XMLGregCal:" + cal.toString() );
System.out.println( "GregCal:" + cal.toGregorianCalendar() );

This will produce the output:
XMLGregCal:2006-11-22T00:00:00.0+01:02
GregCal:java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="GMT+12:00",offset=43200000

The problem seems to be on line 2689 in XMLGregorianCalendarImpl where the 
following code is used to determine the minutes:

int minutes = zoneoffset - (hour * 60);

On line 2700, we have the following code:
if (minutes != 0) {
        customTimezoneId.append(minutes);
}

This will append 2 to the timezone rather than 02. The java.util.TimeZone 
javadoc states that "Minutes must be between 00 to 59".

-- 
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