JDK-6609371 : (tz) New DST rules is not in effect in 1.3.1_18
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-09-26
  • Updated: 2010-07-29
  • Resolved: 2007-10-05
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
1.3.1_18-b01

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
New DST rules are not in effect in this version of Java, despite of http://java.sun.com/developer/technicalArticles/Intl/USDST/

java.util.Date works incorrect.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
I run this test:

***************************************
package samples;

import java.text.SimpleDateFormat;
import java.util.Date;

public class TimeChangesToJVM {

	/*
	 * Run the program and try to change the system time in control panel.
	 */
	
	static SimpleDateFormat sdf=new SimpleDateFormat("MM/dd/yyyy");
	static SimpleDateFormat sdf_hours=new SimpleDateFormat("[MM/dd/yyyy HH:mm]");
	
	public static long hours(Date start, Date end) {
		long hr=(end.getTime()-start.getTime())/3600/1000;
		System.out.println(""+hr+" hours from "+sdf_hours.format(start)+
				" to "+sdf_hours.format(end));
		return hr;
	}
	
	public static void main(String[] args) {
		try {
			long difference=
				hours(sdf.parse("03/11/2006"),sdf.parse("03/12/2006"))-
				hours(sdf.parse("03/11/2007"),sdf.parse("03/12/2007"));

			System.out.println("JRE ("+System.getProperty("java.runtime.version")+") "+
					((difference==0)?"does not":"does")+" follow to new DST rule.");
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

}
***************************************


It works fine for Java 1.5.0_06, but works wrong for any of 1.3 versions.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The program should detect that length of day 03/11/2007 is 23 hours, not 24 - because of new DST rules.
ACTUAL -
It says, length of the day 03/11/2007 is 24 hours.

REPRODUCIBILITY :
This bug can be reproduced always.

Comments
EVALUATION TimeZone support in 1.3.1 and ealier is not capable of handling the real world time zone rule changes. This problem was fixed in 1.4.0.
05-10-2007