[jboss-jira] [JBoss JIRA] Created: (JBXB-142) SoapEncUnitTestCase - Incorrect Timezone Handling
Darran Lofthouse (JIRA)
jira-events at lists.jboss.org
Thu May 22 09:46:02 EDT 2008
SoapEncUnitTestCase - Incorrect Timezone Handling
-------------------------------------------------
Key: JBXB-142
URL: http://jira.jboss.com/jira/browse/JBXB-142
Project: JBoss XML Binding (JBossXB)
Issue Type: Bug
Affects Versions: JBossXB-1.0.0.SP2, JBossXB-2.0.0.CR9
Reporter: Darran Lofthouse
Assigned To: Darran Lofthouse
Fix For: JBossXB-2.0.0.CR10, JBossXB-1.0.0.SP3
The testcase SoapEncUnitTestCase uses incorrect timezone handling.
The following code is within the instantiation of the object being marshalled: -
Calendar varDateTime = (Calendar)new GregorianCalendar(96, 5, 1);
int offset = varDateTime.get(Calendar.ZONE_OFFSET) + varDateTime.get(Calendar.DST_OFFSET);
StringBuffer buf = new StringBuffer();
buf.append("GMT");
if(offset > 0)
{
buf.append('+');
}
buf.append(offset);
varDateTime.setTimeZone(TimeZone.getTimeZone(buf.toString()));
struct.setVarDateTime(varDateTime);
1 - The year is 96 not 1996 so this is before DST offsets began.
2 - The two gets return an offset in milliseconds but the code assumes it is in hours.
3 - The TimeZone.getTimeZone is being passed a "GMT+3600000" this is not understood so GMT is returned by default.
When this test case is executed in CEST the setTimeZone changes the time to: -
<varDateTime>0096-05-31T23:00:00.000Z</varDateTime>
This is expected in the resulting XML.
For portability the Calendar instances needs to be constructed in a way to avoid the users timezone affecting the outcome i.e. varDateTime should be constructed have the timezone set to GMT and then set the exact time.
--
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