Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6609371

(tz) New DST rules is not in effect in 1.3.1_18

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.2
    • core-libs

      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.

            okutsu Masayoshi Okutsu
            okutsu Masayoshi Okutsu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: