JDK-4845752 : (tz) Wrong behavior JDK 1.3.1 in GregorianCalendar at DST boundary time
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.3.1_08,1.3.1_21
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000,windows_2003
  • CPU: x86
  • Submitted: 2003-04-09
  • Updated: 2008-01-23
  • Resolved: 2008-01-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.3.1_22 b02Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Customer Problem Description:
-----------------------------

FULL PRODUCT VERSION :
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03) Java
HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)

FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
If I initiate a GregorianCalendar to the time at DST
boundery I got a different output with JDK 1.3.1 and 1.4.


REGRESSION.  Last worked in version 1.3.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Just run this small programm with JDK 1.4 and then with
1.3.1



EXPECTED VERSUS ACTUAL BEHAVIOR :
JDK version    utc time
1.4.0_01 returns 1017539999000 (Sun Mar 31,2002 3:59:59
Europe/Berlin)
1.3.1 returns 1017536399000 (Sun Mar 31,2002 1:59:59
Europe/Berlin)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
// DST switch on 31 March 2002 at 2:00:00
//
//   |-------|-------X-------|-------|
// 12:00   01:00   03:00   04:00   5:00
//                   ^
//                   |
//       daylight switch from 2:00 to 3:00 by Europe/Berlin

Calendar cal = new GregorianCalendar(2002, Calendar.MARCH, 31, 2, 59, 59);
cal.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
long time = cal.getTime().getTime();
System.out.println(time);

How to reproduce it:

  // DST switch on 31 March 2002 at 2:00:00 by Europe/Berlin
  //
  //   |-------|-------X-------|-------|
  // 12:00   01:00   03:00   04:00   5:00
  //                   ^
  //                   |
  //       daylight switch from 2:00 to 3:00

To reproduce you have just to run this with JDK 1.3.1 and JDK 1.4 to see the
difference:

  Calendar cal = new GregorianCalendar(2002, Calendar.MARCH, 31, 2, 59, 59);
  cal.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
  long time = cal.getTime().getTime();
  System.out.println(time);

JDK version   utc time in ms
1.4.0_01       1017539999000 (Sun Mar 31, 2002 3:59:59 Europe/Berlin)
1.3.1          1017536399000 (Sun Mar 31, 2002 1:59:59 Europe/Berlin)

Comments
SUGGESTED FIX Fixing, but this change in behaviour is guarded by a property setting to protect old apps that might not expect such a fix at this late stage: -Dsun.GregorianCalendar.newDSTchangeover
16-01-2008

EVALUATION Due to a last-minute high priority problem, we are going to implement a fix for this in 1.3.1, with the behaviour change guarded by a property setting.
10-01-2008

EVALUATION Calendar uses a new TimeZone subclass since 1.4.0, which resulted in the behavior change. I'm closing this bug report as "not repro". If a patch is required for 1.3.1_xx, please escalate this bug. ###@###.### 2003-04-10
10-04-2003