Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6362432

(tz) TimeZone.getDefault() returns incorrect timezone.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.4.2
    • core-libs

      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 ----------

            okutsu Masayoshi Okutsu
            jssunw Jitender S (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: