JDK-6261305 : (cal) Not consistent behaviour on Gregorian Calendar with dayligth saving
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2005-04-26
  • Updated: 2011-02-16
  • Resolved: 2005-05-04
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Windows 2000

A DESCRIPTION OF THE PROBLEM :
When the date for dayligth saving is reached the GregorianCalendar has no consistant behaviour and return different values if a set has been done or not .

It seems ( but may be i'm wrong) that the policy for going from
the internal field to the timemillisecond and for going from the timemillisecond to the internal field are not the same and don't considere the dayligth saving in the same way .



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
On a timezone Europe/Dublin	(GMT+00:00) Dublin, Edinburgh, London, Lisbon
Rettrieve a calendar
set the time UTC 1130630400000L(Sun Oct 30 02:00:00 CEST 2005)
     
     long ts = 1130630400000L;
     c.setTimeInMillis(ts);

set the number of minutes to 0 ( which should not change anything because it
was previously at the same value )
   
    c.set(Calendar.MINUTE, 0);

retrieve the UTC time from the calendar

     long tst = c.getTimeInMillis();

The both timestamps are not the same.
   

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the both timestamps should be the same.


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("Europe/Dublin"));
 long ts = 1130630400000L;
c.setTimeInMillis(ts);
c.set(Calendar.MINUTE, 0);
long tst = c.getTimeInMillis();
if(tst!=ts){
   System.err.println("Error");
}
---------- END SOURCE ----------
###@###.### 2005-04-26 09:52:28 GMT

Comments
EVALUATION Currently, there's no way to disambiguate daylight saving time and standard time. I'm closing this problem as a duplicate of 4312621. ###@###.### 2005-05-04 16:01:40 GMT
04-05-2005