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

java.util.GregorianCalendar: incorrect validation in non-lenient

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 5.0
    • 1.2.0, 1.3.0
    • core-libs
    • None
    • b28
    • sparc
    • solaris_2.5, solaris_2.6



      Name: ksC84122 Date: 08/30/99


      The javadoc for java.util.GregorianCalendar.setLenient()
      (see java.util.Calendar.setLenient() ) states:
      -----
      Specify whether or not date/time interpretation is to be lenient.
           With lenient interpretation, a date such as "February 942, 1996"
           will be treated as being equivalent to the 941st day after
           February 1, 1996. With strict interpretation, such dates will
           cause an exception to be thrown.
      -----
           
      However, if java.util.GregorianCalendar.setLenient(false) is called,
      date of January WEEK_OF_MONTH 6, 1996 is interpreted as
      February 7, 1996 and no exception is thrown. The reason this
      is happening is that the GregorianCalendar validation code
      uses getMaximum() to validate non-lenient input instead of getActualMaximum().
      (See Bug Id 4147269).
      This behavior should be explicitly specified in the javadoc.
          
      ======================================================================

            okutsu Masayoshi Okutsu
            skosunw Sko Sko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: