JDK-6533596 : (cal) Calendar obj. does not allow to set time to 1:30 AM EDT - 4th Nov 2007
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-03-12
  • Updated: 2010-07-29
  • Resolved: 2007-03-13
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
1.4.2_11, 1.5.0_10-b03, 1.6.0-b105

ADDITIONAL OS VERSION INFORMATION :
Windows XP, Solaris 10

EXTRA RELEVANT SYSTEM CONFIGURATION :
jre 1.4.2 with DST patch ( tzupdater.jar )

A DESCRIPTION OF THE PROBLEM :
Calendar.getTime() after Calendar.setTime() does not seem to reflect the new DST change. It prints out EST where it should be EDT. This seems to happen only when user tries to use Caldenar.setTime to change the time between 1 to 2 am on Nov 4.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1a) Set the system date to 4th November 2007

1b) Set the System Clock Timezone to ( GMT -05:00 Estern Time ( us & Canada))
( Check the box : Automatically adjust the clock for DST )

2) Set tthe System Clock time to 1:30:00 am EDT

3) Run the sample program
  First line of the output :  it reads the time as 1:30:00 am EDT ( correct one )
  Second line of the output : it prints the time as 1:30:00am EST
       ( Between the first output and second output , the only change i am doing is setting the time to 1:30:00  using calendar.set() function , note that i am not even changing the timezone. ).


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
cal.getTime() Sun Nov 04 01:30:48 EDT 2007
cal.getTime() Sun Nov 04 01:30:48 EDT 2007
ACTUAL -
cal.getTime() Sun Nov 04 01:30:48 EDT 2007
cal.getTime() Sun Nov 04 01:30:48 EST 2007

ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error message

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.util.*;

public class d
{
	public static void main(String args[])
	{
		Calendar cal = Calendar.getInstance(TimeZone.getDefault());

		System.out.println("cal.getTime() " + cal.getTime() );

		cal.set(2007, 10, 4);

		System.out.println("cal.getTime() " + cal.getTime() );
	}

}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
No work around. We can't switch to some other api as this calendar api have been used at different places. and its very crucial api.

Comments
EVALUATION GregorianCalendar takes the standard time if the given time stamp could be either standard or daylight time. Closing this CR as a duplicate of 4312621.
13-03-2007