JDK-6466476 : (tz) Introduction of tzdata2005r can introduce incompatility issues with some JDK1.1 3-letter TZ Ids
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.4.2,5.0,6
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_10,windows_xp
  • CPU: x86,sparc
  • Submitted: 2006-09-01
  • Updated: 2017-05-16
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other Other JDK 6 JDK 7 Other
1.4.2_18-rev,OpenJDK6Fixed 1.4.2_19Fixed 5.0u17Fixed 6u4Fixed 7 b38Fixed OpenJDK6Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
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.

Comments
EVALUATION "EST", "HST", "MST" are the three affected zones.
10-03-2007

WORK AROUND Run the tzupdater tool on the affected JRE with the -bc flag. e.g <JAVA_HOME>/bin/java -jar tzupdater.jar -f -bc
02-03-2007

EVALUATION A compatibility mode flag will be added in JDK 7.
13-11-2006

EVALUATION Reopening this CR. We are evaluating a few options on this Olson vs. JDK 1.1 compatibility issue.
13-09-2006

EVALUATION There is a requirement that Java time zones are fully compatible with the Olson time zone data (4495052). It was obvious that 4495052 couldn't be supported without breaking JDK 1.1 compatibility, which was the reason why use of 3-letter time zone IDs was deprecated as of 4495052 support in 1.4.0.
03-09-2006

WORK AROUND Please remove the EST time zone data file <JRE_HOME>/lib/zi/EST.
01-09-2006

EVALUATION In tzdata2005r (Olson time zone database), "EST" was added as follows. # We generate the files specified below to guard against old files with # obsolete information being left in the time zone binary directory. # We limit the list to names that have appeared in previous versions of # this time zone package. # We do these as separate Zones rather than as Links to avoid problems if # a particular place changes whether it observes DST. # We put these specifications here in the northamerica file both to # increase the chances that they'll actually get compiled and to # avoid the need to duplicate the US rules in another file. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone EST -5:00 - EST Zone MST -7:00 - MST Zone HST -10:00 - HST Zone EST5EDT -5:00 US E%sT Zone CST6CDT -6:00 US C%sT Zone MST7MDT -7:00 US M%sT Zone PST8PDT -8:00 US P%sT This addtion conflicts the JDK 1.1.x time zone IDs. We took the Olson time zone ID compatibility. This also means compatibility with Solaris and Linux as well. As described in the TimeZone class documentation, the use of the 3-letter time zone IDs is deprecated. Please migrate to the Olson time zone IDs -- "America/New_York" for "EST".
01-09-2006