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

(cal) Difference between comment and implementation of DAY_OF_WEEK_IN_MONTH

XMLWordPrintable

    • b114
    • x86
    • windows_7

      FULL PRODUCT VERSION :
      java version 1.7.0_02


      ADDITIONAL OS VERSION INFORMATION :
      Independent of OS. Error in source code.

      A DESCRIPTION OF THE PROBLEM :
      In the sourcecode for java.util.GregorianCalendar there is a comment starting at line 411 concerning minimum and maximum values for fields retrieved with constants ERA, YEAR, MONTH... The minimum for DAY_OF_WEEK_IN_MONTH is -1 according to line 424. But in the declaration of MIN_VALUES[] which is following the comment, there is the line 445: 1, // DAY_OF_WEEK_IN_MONTH. Is the comment with the minimum value of -1, or the respective element in MIN_VALUES[] correct?
      I'll paste the whole questionable comment with the following decleration here (from GregorianCalendar.java):
       /*
           * <pre>
           * Greatest Least
           * Field name Minimum Minimum Maximum Maximum
           * ---------- ------- ------- ------- -------
           * ERA 0 0 1 1
           * YEAR 1 1 292269054 292278994
           * MONTH 0 0 11 11
           * WEEK_OF_YEAR 1 1 52* 53
           * WEEK_OF_MONTH 0 0 4* 6
           * DAY_OF_MONTH 1 1 28* 31
           * DAY_OF_YEAR 1 1 365* 366
           * DAY_OF_WEEK 1 1 7 7
           * DAY_OF_WEEK_IN_MONTH -1 -1 4* 6
           * AM_PM 0 0 1 1
           * HOUR 0 0 11 11
           * HOUR_OF_DAY 0 0 23 23
           * MINUTE 0 0 59 59
           * SECOND 0 0 59 59
           * MILLISECOND 0 0 999 999
           * ZONE_OFFSET -13:00 -13:00 14:00 14:00
           * DST_OFFSET 0:00 0:00 0:20 2:00
           * </pre>
           * *: depends on the Gregorian change date
           */
          static final int MIN_VALUES[] = {
              BCE, // ERA
              1, // YEAR
              JANUARY, // MONTH
              1, // WEEK_OF_YEAR
              0, // WEEK_OF_MONTH
              1, // DAY_OF_MONTH
              1, // DAY_OF_YEAR
              SUNDAY, // DAY_OF_WEEK
              1, // DAY_OF_WEEK_IN_MONTH
              AM, // AM_PM
              0, // HOUR
              0, // HOUR_OF_DAY
              0, // MINUTE
              0, // SECOND
              0, // MILLISECOND
              -13*ONE_HOUR, // ZONE_OFFSET (UNIX compatibility)
              0 // DST_OFFSET
          };


      REPRODUCIBILITY :
      This bug can be reproduced always.

            nishjain Nishit Jain
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: