Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8183693 | 8u161 | Unassigned | P3 | Resolved | Fixed | b01 |
JDK-8192293 | emb-8u161 | Unassigned | P3 | Resolved | Fixed | b01 |
FULL PRODUCT VERSION :
java version " 1.7.0_02 "
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux <hostname> 2.6.32.46-0.3-xen #1 SMP 2011-09-29 17:49:31 +0200 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
issue with getting the timezone of an XMLGregorianCalendar when the offset is less than 10 minutes.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. create an Instance of XMLGregorianCalendar with an time offset smaller than 10 minutes
for example offset of 5 min: 2012-10-01T05:06:07+00:05
2. call the function getTimeZone on the new created Object
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
expected Timezone ID is:
GMT+00:05
ACTUAL -
actual Result Timezone ID is:
GMT+05:00
ERROR MESSAGES/STACK TRACES THAT OCCUR :
no error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package TestCode;
import java.util.TimeZone;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeConstants;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
/**
*
* @author schreibe
*/
public class GetTimeZoneBug {
public GetTimeZoneBug() {
}
public void showBug(String xmlTimestamp) {
System.out.println( " showBug method was called with xmlTimestamp: " + xmlTimestamp);
try {
XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(xmlTimestamp);
/*
* The Bug appears inside of the getTimeZone function if the XMLGregorianCalendar was created with a offset less than 10 minutes.
*/
TimeZone xmlTZ = xmlCal.getTimeZone(DatatypeConstants.FIELD_UNDEFINED);
System.out.println( " timezone of xmlgregoriancalendar: " + xmlTZ.getID());
} catch(DatatypeConfigurationException e) {
System.out.println( " exception while creating xmlGregorianCalendar objec: " + e.getMessage());
}
}
public static void main(String[] args) {
GetTimeZoneBug gtzb = new GetTimeZoneBug();
gtzb.showBug( " 2012-10-01T05:06:07+00:05 " );
gtzb.showBug( " 2012-10-01T05:06:07+00:06 " );
gtzb.showBug( " 2012-10-01T05:06:07+00:07 " );
gtzb.showBug( " 2012-10-01T05:06:07+00:08 " );
gtzb.showBug( " 2012-10-01T05:06:07+00:09 " );
gtzb.showBug( " 2012-10-01T05:06:07+00:10 " );
gtzb.showBug( " 2012-10-01T05:06:07+00:11 " );
gtzb.showBug( " 2012-10-01T05:06:07+00:12 " );
System.out.println( "
just another example: " );
gtzb.showBug( " 2012-10-01T05:06:07+02:01 " );
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
a workaorund is to normalize the xmlGregorianCalendar before continue on processing it by calling
xmlCal.normalize();
java version " 1.7.0_02 "
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux <hostname> 2.6.32.46-0.3-xen #1 SMP 2011-09-29 17:49:31 +0200 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
issue with getting the timezone of an XMLGregorianCalendar when the offset is less than 10 minutes.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. create an Instance of XMLGregorianCalendar with an time offset smaller than 10 minutes
for example offset of 5 min: 2012-10-01T05:06:07+00:05
2. call the function getTimeZone on the new created Object
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
expected Timezone ID is:
GMT+00:05
ACTUAL -
actual Result Timezone ID is:
GMT+05:00
ERROR MESSAGES/STACK TRACES THAT OCCUR :
no error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package TestCode;
import java.util.TimeZone;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeConstants;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
/**
*
* @author schreibe
*/
public class GetTimeZoneBug {
public GetTimeZoneBug() {
}
public void showBug(String xmlTimestamp) {
System.out.println( " showBug method was called with xmlTimestamp: " + xmlTimestamp);
try {
XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(xmlTimestamp);
/*
* The Bug appears inside of the getTimeZone function if the XMLGregorianCalendar was created with a offset less than 10 minutes.
*/
TimeZone xmlTZ = xmlCal.getTimeZone(DatatypeConstants.FIELD_UNDEFINED);
System.out.println( " timezone of xmlgregoriancalendar: " + xmlTZ.getID());
} catch(DatatypeConfigurationException e) {
System.out.println( " exception while creating xmlGregorianCalendar objec: " + e.getMessage());
}
}
public static void main(String[] args) {
GetTimeZoneBug gtzb = new GetTimeZoneBug();
gtzb.showBug( " 2012-10-01T05:06:07+00:05 " );
gtzb.showBug( " 2012-10-01T05:06:07+00:06 " );
gtzb.showBug( " 2012-10-01T05:06:07+00:07 " );
gtzb.showBug( " 2012-10-01T05:06:07+00:08 " );
gtzb.showBug( " 2012-10-01T05:06:07+00:09 " );
gtzb.showBug( " 2012-10-01T05:06:07+00:10 " );
gtzb.showBug( " 2012-10-01T05:06:07+00:11 " );
gtzb.showBug( " 2012-10-01T05:06:07+00:12 " );
System.out.println( "
just another example: " );
gtzb.showBug( " 2012-10-01T05:06:07+02:01 " );
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
a workaorund is to normalize the xmlGregorianCalendar before continue on processing it by calling
xmlCal.normalize();
- backported by
-
JDK-8183693 XmlGregorianCalendarImpl.getTimeZone() bug when offset is less than 10 minutes
-
- Resolved
-
-
JDK-8192293 XmlGregorianCalendarImpl.getTimeZone() bug when offset is less than 10 minutes
-
- Resolved
-