JDK-4177904 : JDK1.2fcsL regression: default timezone incorrectly initialized
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.2.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5
  • CPU: sparc
  • Submitted: 1998-10-01
  • Updated: 1998-10-01
  • Resolved: 1998-10-01
Related Reports
Duplicate :  
Description

Name: mgC56079			Date: 10/01/98



JDK1.2fcsL incorrectly initializes default timezone (JDK1.2fcsK works correctly).

I wrote a minimized test to check this:
===== DateTest1.java ====
import java.util.Date;
import java.util.TimeZone;

public class DateTest1 {

  public static void main(String args[]) {
        System.out.println(TimeZone.getDefault());
        System.out.println(TimeZone.getDefault().getRawOffset());

	int yearVal = 0;
	int monthVal = 0; 
	int dayVal = 1;

	Date OUT = new Date(yearVal, monthVal, dayVal);
        System.out.println(OUT);
  }

}
========= Sample run (JDK1.2 beta4, correct) ==========
(###@###.###)/home/gor/bugs: java DateTest1
java.util.SimpleTimeZone[id=Europe/Moscow,offset=10800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=7200000,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=10800000]
10800000
Mon Jan 01 00:00:00 GMT+03:00 1900
========= Sample run (JDK1.2 fcs-L, WRONG) ==========
(###@###.###)/home/gor/bugs: java DateTest1
java.util.SimpleTimeZone[id=Custom,offset=14400000,dstSavings=3600000,useDaylight=false,startYear=0,startMode=0,startMonth=0,startDay=0,startDayOfWeek=0,startTime=0,endMode=0,endMonth=0,endDay=0,endDayOfWeek=0,endTime=0]
14400000
Mon Jan 01 00:00:00 GMT+04:00 1900
=============

Raw offset is incorrect, this causes JCK test failures:
api/java_util/Date/desc.html#Date_int_int_int
api/java_util/Date/desc.html#Date_int_int_int_int_int
api/java_util/Date/desc.html#Date_int_int_int_int_int_int

Note: Out timezone is Europe/Moscow, rawOffset=+03:00 but the problem is 
not specific to it. This is also a problem for PST (rawOfset in initialized to -07:00
instead of -08:00). See jck bug 4177605 for details.

======== This is a sample jtr file for PST timezone ========
#Test Results
#Sun Sep 27 23:30:28 PDT 1998
description=file:/net/tapas/export1/testexec/JCK-12a/tests/api/java_util/Date/desc.html#Date_int_int_int
testsuite=/net/tapas/export1/testexec/JCK-12a/tests
executeArgs=-TestCaseID int3 -GMTOffset $gmtOffset
execStatus=Failed. tests: 1; failed: 1; first test case failure: int3
end=Sun Sep 27 23:30:28 PDT 1998
work=/net/tapas/export1/testexec/results/l2celery12a_26_Japanese/api/java_util/Date
executeClass=javasoft.sqe.tests.api.java.util.Date.CtorTests
status=Failed. tests: 1; failed: 1; first test case failure: int3
keywords=positive runtime util
start=Sun Sep 27 23:30:26 PDT 1998
title=Date( int, int, int ) - Deprecated
javatestVersion=JT_2.0_zd
id=Date_int_int_int
file=/net/tapas/export1/testexec/JCK-12a/tests/api/java_util/Date/desc.html
name=Date_int3
sections=testExecute testExecute
environment=jck-runtime-solaris
source=CtorTests.java

test: api/java_util/Date/desc.html#Date_int_int_int
script: javasoft.sqe.javatest.lib.JCKScript -runtime
Executing test class...
command: javasoft.sqe.javatest.lib.ExecJCKTestOtherJVMCmd CLASSPATH=/net/tapas/export1/testexec/results/l2celery12a_26_Japanese/classes:/net/tapas/export1/testexec/JCK-12a/tests/../classes:/net/tapas/export1/testexec/JCK-12a/javatest.jar:/net/tapas/export1/testexec/jdk12l/solaris/lib/tools.jar:/net/tapas/export1/testexec/jdk12l/solaris/jre/lib/rt.jar:/net/tapas/export1/testexec/jdk12l/solaris/jre/lib/i18n.jar DISPLAY=celery:0.0 HOME=/home/rickr LD_LIBRARY_PATH=/net/tapas/export1/testexec/JCK-12a/tests/../lib:/net/tapas/export1/testexec/JCK-12a/tests/../lib_solaris: /net/tapas/export1/testexec/jdk12l/solaris/bin/java -verify javasoft.sqe.tests.api.java.util.Date.CtorTests -TestCaseID int3 -GMTOffset -8.0
----------ref:testExecute(2/122)----------
Expected: Mon Jan 01 01:00:00 GMT-07:00 1900: -2208960000000
Received: Mon Jan 01 00:00:00 GMT-07:00 1900: -2208963600000
----------log:testExecute(3/135)----------
-28800000
int3: Failed. Received: Mon Jan 01 00:00:00 GMT-07:00 1900
STATUS:Failed. tests: 1; failed: 1; first test case failure: int3
command result: Failed. tests: 1; failed: 1; first test case failure: int3
test result: Failed. tests: 1; failed: 1; first test case failure: int3

======================================================================

Comments
EVALUATION This looks like a duplicate of 4177450. The problem is that in 1.2fcsL, the timezone initialization code has a bug in it which causes failure to match the host timezone to the Java system zone list if the locale has no country. That is, if the locale is "C", then the zone will show up (for example) as GMT-8:00 instead of America/Los_Angeles. This is indicated by the fact that the default time zone has an id of "Custom" instead of "Europe/Moscow" (in this bug report). I am double checking with the submitter to make sure that his locale is set to something with no country, which will confirm this. If not, then I will reopen this bug. alan.liu@eng 1998-10-01
01-10-1998