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

TimeZone.getOffset() does not return a modified offset in 0095

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 1.4.1
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description



      Name: rmT116609 Date: 07/18/2002


      FULL PRODUCT VERSION :
      java version "1.4.1-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b14)
      Java HotSpot(TM) Client VM (build 1.4.1-beta-b14, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      sun.util.calendar.ZoneInfo, which is used as the TimeZone class in java.util.GregorianCalendar, does not return a modified offset in case of daylight savings when getOffset() is called for the following case:

      GregorianCalendar c = new GregorianCalendar(95,5,1);
      int offset = c.getTimeZone().getOffset(c.get(Calendar.ERA),
                                c.get(Calendar.YEAR),
                                c.get(Calendar.MONTH),
                                c.get(Calendar.DAY_OF_MONTH),
                                c.get(Calendar.DAY_OF_WEEK),
                                c.get(Calendar.MILLISECOND));

      In jdk 1.4, 1.4.1-beta the offset is -28800000, in jdk 1.3.1 it is -25200000. In both cases the id of the TimeZone is America/Los_Angeles.

      REGRESSION. Last worked in version 1.3.1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. run code snippet from description under jdk 1.4, 1.4.1-beta and 1.3.1

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      offset should be -25200000 but is -28800000

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.Calendar;
      import java.util.GregorianCalendar;

      public class Test {

        public static void main(String[] args) {
          
          GregorianCalendar c = new GregorianCalendar(96,5,1);
          int offset = c.getTimeZone().getOffset(c.get(Calendar.ERA),
                                                 c.get(Calendar.YEAR),
                                                 c.get(Calendar.MONTH),
                                                 c.get(Calendar.DAY_OF_MONTH),
                                                 c.get(Calendar.DAY_OF_WEEK),
                                                 c.get(Calendar.MILLISECOND));

          System.out.println("offset " + offset);

        }
        
      }

      ---------- END SOURCE ----------

      Release Regression From : 1.3.1_04
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Review ID: 159536)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              okutsu Masayoshi Okutsu
              Reporter:
              rmandalasunw Ranjith Mandala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: