TimeZone cannot find time zone if called after Class.getResource(..)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
sun-java6 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
1. Reproducible at least on Ubuntu 9.10 desktop, amd64 with the following java version:
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Server VM (build 16.3-b01, mixed mode)
-----------------
ia32-sun-java6-bin:
Installed: 6.20dlj-
Candidate: 6.20dlj-
Version table:
*** 6.20dlj-
500 http://
100 /var/lib/
6-15-1 0
500 http://
-----------------
Only 32bit JVM is affected (ia32-sun-
2. How to reproduce:
Compile and run the following Java class:
-------
import java.util.TimeZone;
public class Test {
public static void main(String[] args) throws Exception {
String.
TimeZone tz1 = TimeZone.
System.
}
}
-------
You will see "GMT" in the console. It means that Java was unable to locate information on EST5EDT time zone. In fact, it does not know anything about time zones at all in this case.
However, if you move the "getResource" call one line lower so that the TimeZone is located earlier...
-------
import java.util.TimeZone;
public class Test {
public static void main(String[] args) throws Exception {
TimeZone tz1 = TimeZone.
String.
System.
}
}
-------
You will see "EST5EDT" in the console, which confirms that Java was able to find the time zone information.
----
I have tried reproducing the code on 32 bit JVM of the same version downloaded from Sun. The bug does not reproduce there. This means, I believe, that the bug might be somehow related to the way the JVM is installed in Ubuntu.Java.
The same problem is in Lucid Lynx.