-
Bug
-
Resolution: Fixed
-
P4
-
1.4.2, 5.0, 6
-
b38
-
x86, sparc
-
solaris_10, windows_xp
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2151179 | 6u4 | Masayoshi Okutsu | P4 | Resolved | Fixed | b04 |
JDK-2186159 | OpenJDK6 | Yuka Kamiya | P3 | Resolved | Fixed | b18 |
JDK-2168683 | 5.0u17 | Abhijit Saha | P3 | Resolved | Fixed | b02 |
JDK-2151535 | 5.0u16-rev | Sean Coffey | P4 | Resolved | Fixed | b09 |
JDK-2201072 | 1.4.2_19 | Sean Coffey | P4 | Resolved | Fixed | b04 |
JDK-2154464 | 1.4.2_18-rev | Sean Coffey | P4 | Closed | Fixed | b12 |
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)
and
java version "1.6.0-beta2"
Java(TM) SE Runtime Environment (build 1.6.0-beta2-b86)
Java HotSpot(TM) Client VM (build 1.6.0-beta2-b86, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Update 08 changed the interpretation of "EST" to not include DST.
This means that all legacy Applets and applications which used EST before are now broken.
See the outputs from the demo program. Eastern and EST should be the same under all Java versions.
************************
Time Zone Test on JVM 1.5.0_06
Current time in EST = 8/31/06 9:42 PM
Correct Eastern time = 8/31/06 9:42 PM
Current time in PST = 8/31/06 6:42 PM
Correct Pacific time = 8/31/06 6:42 PM
EST = sun.util.calendar.ZoneInfo[id="EST",offset=-18000000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=EST,offset=-18000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]
PST = sun.util.calendar.ZoneInfo[id="PST",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=PST,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]
**********************************
Time Zone Test on JVM 1.5.0_08
Current time in EST = 8/31/06 8:42 PM
Correct Eastern time = 8/31/06 9:42 PM
Current time in PST = 8/31/06 6:42 PM
Correct Pacific time = 8/31/06 6:42 PM
EST = sun.util.calendar.ZoneInfo[id="EST",offset=-18000000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
PST = sun.util.calendar.ZoneInfo[id="PST",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=PST,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]
*********************************
Time Zone Test on JVM 1.6.0-beta2
Current time in EST = 8/31/06 8:43 PM
Correct Eastern time = 8/31/06 9:43 PM
Current time in PST = 8/31/06 6:43 PM
Correct Pacific time = 8/31/06 6:43 PM
EST = sun.util.calendar.ZoneInfo[id="EST",offset=-18000000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
PST = sun.util.calendar.ZoneInfo[id="PST",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=PST,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the following code under different versions of Java and see the results.
Run under 1.5.0_06
Run under 1.5.0_08
Run under 1.6 beta 2
public class TimeUtil {
private static TimeZone PACIFIC = null;
private static TimeZone EASTERN = null;
/**
* Getting eastern daylight savings time in a way that returns a valid time zone for JDK 1.1 and
* all later versions.
* @return Eastern time
*/
public static TimeZone getEastern() {
if (EASTERN == null) {
EASTERN = chooseTimeZone(new String[] { "America/New_York", "EST5EDT", "EST" });
}
return EASTERN;
}
/**
* Getting pacific daylight savings time in a way that returns a valid time zone for JDK 1.1 and
* all later versions.
* @return Pacific time
*/
public static TimeZone getPacific() {
if (PACIFIC == null) {
PACIFIC = chooseTimeZone(new String[] { "America/Los_Angeles", "PST8PDT", "PST" });
}
return PACIFIC;
}
private static TimeZone chooseTimeZone(String[] preferredChoices) {
boolean[] availableChoices = new boolean[preferredChoices.length];
for (int i = 0; i < availableChoices.length; i++) {
availableChoices[i] = false;
}
String[] tz = TimeZone.getAvailableIDs();
for (int i = 0; i < tz.length; i++) {
String zoneName = tz[i];
//System.out.println("checking: "+zoneName);
for (int j = 0; j < preferredChoices.length; j++) {
if (zoneName.equals(preferredChoices[j])) {
availableChoices[j] = true;
}
}
}
for (int i = 0; i < availableChoices.length; i++) {
if (availableChoices[i]) {
//System.out.println("Using "+preferredChoices[i]);
return TimeZone.getTimeZone(preferredChoices[i]);
}
}
return null;
}
/**/
// Test the time zones on current VM
public static void main(String[] args) {
System.out.println("Time Zone Test on JVM "+ System.getProperty("java.version"));
DateFormat fmt = new SimpleDateFormat();
Date date = new Date();
fmt.setTimeZone(TimeZone.getTimeZone("EST"));
System.out.println("Current time in EST = "+fmt.format(date));
fmt.setTimeZone(getEastern());
System.out.println("Correct Eastern time = "+fmt.format(date));
fmt.setTimeZone(TimeZone.getTimeZone("PST"));
System.out.println("Current time in PST = "+fmt.format(date));
fmt.setTimeZone(getPacific());
System.out.println("Correct Pacific time = "+fmt.format(date));
System.out.println("EST = "+TimeZone.getTimeZone("EST"));
System.out.println("PST = "+TimeZone.getTimeZone("PST"));
}
/**/
}
Outputs:
************************
Time Zone Test on JVM 1.5.0_06
Current time in EST = 8/31/06 9:42 PM
Correct Eastern time = 8/31/06 9:42 PM
Current time in PST = 8/31/06 6:42 PM
Correct Pacific time = 8/31/06 6:42 PM
EST = sun.util.calendar.ZoneInfo[id="EST",offset=-18000000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=EST,offset=-18000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]
PST = sun.util.calendar.ZoneInfo[id="PST",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=PST,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]
**********************************
Time Zone Test on JVM 1.5.0_08
Current time in EST = 8/31/06 8:42 PM
Correct Eastern time = 8/31/06 9:42 PM
Current time in PST = 8/31/06 6:42 PM
Correct Pacific time = 8/31/06 6:42 PM
EST = sun.util.calendar.ZoneInfo[id="EST",offset=-18000000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
PST = sun.util.calendar.ZoneInfo[id="PST",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=PST,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]
*********************************
Time Zone Test on JVM 1.6.0-beta2
Current time in EST = 8/31/06 8:43 PM
Correct Eastern time = 8/31/06 9:43 PM
Current time in PST = 8/31/06 6:43 PM
Correct Pacific time = 8/31/06 6:43 PM
EST = sun.util.calendar.ZoneInfo[id="EST",offset=-18000000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
PST = sun.util.calendar.ZoneInfo[id="PST",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=PST,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected:
EST and Eastern time are always the same
ACTUAL -
EST is one hour offset from Eastern time
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class TimeUtil {
private static TimeZone PACIFIC = null;
private static TimeZone EASTERN = null;
/**
* Getting eastern daylight savings time in a way that returns a valid time zone for JDK 1.1 and
* all later versions.
* @return Eastern time
*/
public static TimeZone getEastern() {
if (EASTERN == null) {
EASTERN = chooseTimeZone(new String[] { "America/New_York", "EST5EDT", "EST" });
}
return EASTERN;
}
/**
* Getting pacific daylight savings time in a way that returns a valid time zone for JDK 1.1 and
* all later versions.
* @return Pacific time
*/
public static TimeZone getPacific() {
if (PACIFIC == null) {
PACIFIC = chooseTimeZone(new String[] { "America/Los_Angeles", "PST8PDT", "PST" });
}
return PACIFIC;
}
private static TimeZone chooseTimeZone(String[] preferredChoices) {
boolean[] availableChoices = new boolean[preferredChoices.length];
for (int i = 0; i < availableChoices.length; i++) {
availableChoices[i] = false;
}
String[] tz = TimeZone.getAvailableIDs();
for (int i = 0; i < tz.length; i++) {
String zoneName = tz[i];
//System.out.println("checking: "+zoneName);
for (int j = 0; j < preferredChoices.length; j++) {
if (zoneName.equals(preferredChoices[j])) {
availableChoices[j] = true;
}
}
}
for (int i = 0; i < availableChoices.length; i++) {
if (availableChoices[i]) {
//System.out.println("Using "+preferredChoices[i]);
return TimeZone.getTimeZone(preferredChoices[i]);
}
}
return null;
}
/**/
// Test the time zones on current VM
public static void main(String[] args) {
System.out.println("Time Zone Test on JVM "+ System.getProperty("java.version"));
DateFormat fmt = new SimpleDateFormat();
Date date = new Date();
fmt.setTimeZone(TimeZone.getTimeZone("EST"));
System.out.println("Current time in EST = "+fmt.format(date));
fmt.setTimeZone(getEastern());
System.out.println("Correct Eastern time = "+fmt.format(date));
fmt.setTimeZone(TimeZone.getTimeZone("PST"));
System.out.println("Current time in PST = "+fmt.format(date));
fmt.setTimeZone(getPacific());
System.out.println("Correct Pacific time = "+fmt.format(date));
System.out.println("EST = "+TimeZone.getTimeZone("EST"));
System.out.println("PST = "+TimeZone.getTimeZone("PST"));
}
/**/
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround.
Release Regression From : 5.0u6
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
- backported by
-
JDK-2168683 (tz) Introduction of tzdata2005r can introduce incompatility issues with some JDK1.1 3-letter TZ Ids
- Resolved
-
JDK-2186159 (tz) Introduction of tzdata2005r can introduce incompatility issues with some JDK1.1 3-letter TZ Ids
- Resolved
-
JDK-2151179 (tz) Introduction of tzdata2005r can introduce incompatility issues with some JDK1.1 3-letter TZ Ids
- Resolved
-
JDK-2151535 (tz) Introduction of tzdata2005r can introduce incompatility issues with some JDK1.1 3-letter TZ Ids
- Resolved
-
JDK-2201072 (tz) Introduction of tzdata2005r can introduce incompatility issues with some JDK1.1 3-letter TZ Ids
- Resolved
-
JDK-2154464 (tz) Introduction of tzdata2005r can introduce incompatility issues with some JDK1.1 3-letter TZ Ids
- Closed
- duplicates
-
JDK-6471224 (tz) The Daylight Savings for EST timezone is incorrect.
- Closed
-
JDK-6521162 (tz) New US Daylight Saving not working properly
- Closed
-
JDK-6609359 (tz) TimeZone.inDaylightTime() does not work
- Closed
-
JDK-6609361 TimeZone object have no information about transitions for EST timezone
- Closed
-
JDK-6993107 local zone setTimeZone ignores daylight
- Closed
- relates to
-
JDK-6530336 (tz) DST bug in latest jdk releases when using EST MST and HST abbreviations
- Closed
-
JDK-4495052 RFE: Java should support complete set of Olson time zones
- Resolved
-
JDK-4263805 (tz) need complete support of POSIX TZ syntax
- Closed
-
JDK-8025971 Remove java.time.ZoneId.OLD_SHORT_IDS
- Closed