JDK-4891536 : JRE 1.4.1_02 fails to detect the default time-zone correctly
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.4.1
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-07-16
  • Updated: 2003-07-22
  • Resolved: 2003-07-22
Related Reports
Duplicate :  
Description

Name: gm110360			Date: 07/16/2003


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

FULL OS VERSION :
Windows 2000 SP3

EXTRA RELEVANT SYSTEM CONFIGURATION :
Locale = en_AU
Time-Zone = (GMT + 10:00) Canberra, Melbourne, Sydney (with daylight savings enabled)

A DESCRIPTION OF THE PROBLEM :
I have scanned the forum and this seems to be a recurring problem since JRE 1.1. I have the time zone on my machine set to Australia/Sydney. After installing version 1.4.1_o2 of the JDK, I ran a simple java application which basically prints the results of the following line of code to the standard output:

System.out.println(TimeZone.getDefault().toString());

---------------- EXPECTED RESULT-------------------------

sun.util.calendar.ZoneInfo[id="Australia/Sydney",offset=36000000,dstSavings=3600000,useDaylight=true,transitions=142,lastRule=java.util.SimpleTimeZone[id=Australia/Sydney,offset=36000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=9,startDay=-1,startDayOfWeek=1,startTime=7200000,startTimeMode=1,endMode=2,endMonth=2,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=1]]

------------- END EXPECTED RESULT ----------------------

The result I got was:

-------------- ACTUAL RESULT ----------------------------

sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstDavings=0,useDaylight=false,transitions=0,lastRule=null]

-------------END ACTUAL RESULT --------------------------

This is clearly incorrect. However, I discovered you can rectify the problem by changed the System time-zone to some other time-zone and then switch it back to Australia/Sydney.
This seems to rectify the problem. However, this is not a preferable soultion. Is there any way to make the JRE correctly auto-detect the correct time-zone.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) On a clean Windows 2000 with SP3 machine which has not had a previous version of the JDK installed, run the JDK 1.4.1_02 installer. Make sure you have your time-zone set to Australian/Sydney before installing.
2) Once installed, create a simple class, and in the main function, add the following line of code:

System.out.println(TimeZone.getDefault().toString());

3) Run the application and note the output.
4) To correct the problem change the system time-zone and then change it back to Australian/Sydney.
5) Run the application again - the time-zone will now be correct.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
sun.util.calendar.ZoneInfo[id="Australia/Sydney",offset=36000000,dstSavings=3600000,useDaylight=true,transitions=142,lastRule=java.util.SimpleTimeZone[id=Australia/Sydney,offset=36000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=9,startDay=-1,startDayOfWeek=1,startTime=7200000,startTimeMode=1,endMode=2,endMonth=2,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=1]]
ACTUAL -
sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstDavings=0,useDaylight=false,transitions=0,lastRule=null]


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------

import java.util.TimeZone;
import java.util.Locale;

public class tz
{
    public static void main(String[] aArgs)
    {
        System.out.println(Locale.getDefault().toString());
        System.out.println(TimeZone.getDefault().toString());
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Switch system time-zone, then switch back to Australian/Sydney.
(Incident Review ID: 186300) 
======================================================================

Comments
EVALUATION If this is a bug, it would be for the TimeZone library, not the installer. ###@###.### 2003-07-17 This is a duplicate of 4762673. Windows 2000 SP3 installer doesn't update the current time zone data, which creates the inconsistency between the current one and the Time Zones data. Then, 1.4.x fails to detect the time zone. 1.3.x checked less time zone parameters and didn't fail. ###@###.### 2003-07-22
22-07-2003