JDK-6362432 : (tz) TimeZone.getDefault() returns incorrect timezone.
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-12-13
  • Updated: 2010-07-29
  • Resolved: 2006-06-05
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.4.2_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
If I set my timezone to (GMT+8:00) Kuala Lumpur, Singapore with 'Automatically adjust clock for daylight saving changes' checked on other timezones (because (GMT+8:00) Kuala Lumpur, Singapore itself doesn't have Daylight Saving Time), run the test progam, it returns incorrect default timezone as GMT.
If I uncheck the Daylight Saving checkbox, it returns correct timezone as GMT+8:00.
But if I set my timezone to (GMT+8:00) Perth or (GMT+8:00) Beijing, it returns correct timezone regardless whether I set the Daylight Saving time in other regions.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Test 1:
1. Select Windows XP timezone as (GMT+10:00) Canberra, Melbourne, Sydney.
2. Check the 'Automatically adjust clock for daylight saving changes' checkbox.
3. Change the timezone to (GMT+8:00) Kuala Lumpur, Singapore.
4. Run test program

Test 2:
1. Select Windows XP timezone as (GMT+10:00) Canberra, Melbourne, Sydney.
2. Uncheck the 'Automatically adjust clock for daylight saving changes' checkbox.
3. Change the timezone to (GMT+8:00) Kuala Lumpur, Singapore.
4. Run test program


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
For Test1, it should return as follows,

sun.util.calendar.ZoneInfo[id="GMT+08:00",offset=28800000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
ACTUAL -
sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,tran
sitions=0,lastRule=null]

REPRODUCIBILITY :
This bug can be reproduced always.

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

public class DefaultTimezoneTest {
  public static void main(String[] argv) {
    System.out.println("Current Time Zone:");
    System.out.println(TimeZone.getDefault());
  }
}
---------- END SOURCE ----------

Comments
EVALUATION Closing this CR as "Not Reproducible".
2006-06-05

EVALUATION I cannot reproduce this bug with 1.4.2_03 on my Windows XP environment. My result for Test 1: Current Time Zone: sun.util.calendar.ZoneInfo[id="GMT+08:00",offset=28800000,dstSavings=0,useDaylig ht=false,transitions=0,lastRule=null] My result for Test 2: Current Time Zone: sun.util.calendar.ZoneInfo[id="Asia/Singapore",offset=28800000,dstSavings=0,useD aylight=false,transitions=8,lastRule=null] Now I have a question to the submitter. What does your test program display for Test 2? Same as mine?
2005-12-20