United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6583152 KernelJRE picks wrong TimeZone
JDK-6583152 : KernelJRE picks wrong TimeZone

Details
Type:
Bug
Submit Date:
2007-07-20
Status:
Closed
Updated Date:
2010-09-08
Project Name:
JDK
Resolved Date:
2008-04-17
Component:
deploy
OS:
windows
Sub-Component:
deployment_toolkit
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
6u4
Fixed Versions:
6u4 (b03)

Related Reports

Sub Tasks

Description
KernelJRE picks wrong TimeZone. 
For the TimeZone: America/Los_Angeles and Locale :en_US  
KernalJRE picks the ZONE as GMT but it should be PST.

<tescase>
import java.util.*;

public class Foo {
	private static String[] calendar_formats = {
	        "%ts' (0 - 99...?)",
	        "%tz  (-1200 - +1200) ZONE_NUMERIC",
	        "%tZ ZONE (symbol)",
		" DATE_TIME %tc  (Sat Nov 04 12:02:33 EST 1999)",
        };
	public static void main(String... arg) {
		TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
		Locale local = new Locale("en_US");
		Calendar c = new GregorianCalendar(tz, local);
		c.clear();
		c.set(1977, 10, 15);
		StringBuffer sb = new StringBuffer(58);
		Formatter formatter = new Formatter(sb);
		for(String format: calendar_formats) {
		    formatter.format(format+" \n",c);
		}
		System.out.println(sb.toString());
	}
}
</testcase>

<output with kernalJRE>
F:\Kernal>f:\jre1.6.0_02\bin\java Foo
248400000' (0 - 99...?)
+0000  (-1200 - +1200) ZONE_NUMERIC
GMT ZONE (symbol)
 DATE_TIME Tue Nov 15 00:00:00 GMT 1977  (Sat Nov 04 12:02:33 EST 1999)


F:\Kernal>f:\jre1.6.0_02\bin\java -version
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b99)
Java HotSpot(TM) Client VM (build 1.7.0-internal, mixed mode)
</output with kernalJRE>

<NormalJRE>
F:\Kernal>java Foo
248428800' (0 - 99...?)
-0800  (-1200 - +1200) ZONE_NUMERIC
PST ZONE (symbol)
 DATE_TIME Tue Nov 15 00:00:00 PST 1977  (Sat Nov 04 12:02:33 EST 1999)


F:\Kernal>java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b15)
Java HotSpot(TM) Client VM (build 1.7.0-ea-b15, mixed mode)
</NormalJRE>
Simplified testcase:
<testcase>
import java.text.*;
import java.util.*;
class GetInstanceTimeZone {
  public static void main(String[] args) throws Exception {
    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("PST"));
    TimeZone tz = cal.getTimeZone();
    if (tz.getID() != "PST") {
      System.out.println("Test Failed to getInstance(TimeZone)");
      System.out.println("Expected: PST");
      System.out.println("Actual  : "+tz.getID());
    }
  }
}
</tescase>

                                    

Comments
EVALUATION

This is due to the lib/zi/... time zone information files not being part of the core download.  I tried bundling them together with the Calendar classes, so that they would be present on the system by the time the calendar code is initialized, to no avail.

For the time being, the lib/zi/... files have simply been made part of the core.
                                     
2007-07-25



Hardware and Software, Engineered to Work Together