-
Bug
-
Resolution: Fixed
-
P3
-
1.1.6
-
1.1.6
-
sparc
-
solaris_2.5
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2018893 | 1.2.0 | Shanmugam Senthil | P3 | Resolved | Fixed | 1.2beta4 |
Name: mgC56079 Date: 02/02/98
The java.util.Date class works wrong if the current TimeZone is changed
after the class has been loaded.
This bug is introduced in jdk1.1.6
----- Here is the test -----
import java.util.TimeZone;
import java.util.Date;
public class TZ {
public static void main(String args[]) {
// load the java.util.Date class in the GMT timezone
TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
new Date(); // load the class (to run static initializers)
// use the class in different timezone
TimeZone.setDefault(TimeZone.getTimeZone("PST"));
System.out.println("Expected: Sat Feb 01 00:00:00 PST 1997");
System.out.println("Result: "+new Date(97,1,1));
}
}
----- Here is the correct output (jdk1.1.5) -----
Expected: Sat Feb 01 00:00:00 PST 1997
Result: Sat Feb 01 00:00:00 PST 1997
----- Here is the WRONG output (jdk1.1.6) -----
Expected: Sat Feb 01 00:00:00 PST 1997
Result: Fri Jan 31 16:00:00 PST 1997
----------
The bug causes a JCK test failure:
api/java_sql/Timestamp/manual.html#Ctor
======================================================================
- backported by
-
JDK-2018893 java.util.Date fails if current TimeZone is changed (regression)
-
- Resolved
-