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

Calendar class outputs exception on 02-29-2004 and 12-31-2004

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P2 P2
    • None
    • 5.0
    • core-libs

      There seems regression in 1.5.0beta(b37) when we use the Calendar class.

      Calendar instance outputs java.lang.IllegalArgumentException
      on 02-29-2004 and 12-31-2004 in 1.5.0 and 1.3.1(_0X),
      but it works well in 1.4.X.


      To REPRODUCE:

       (1) Compile the attched program(LeapYear.java)
       (2) Set the date of your PC to 2-29-2004
       (3) Launch "java LeapYear"
          ==> You will see the exception.
      K:\temp>java LeapYear
              java.lang.IllegalArgumentException: MONTH
              at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2392)
              at java.util.Calendar.updateTime(Calendar.java:2241)
              at java.util.Calendar.complete(Calendar.java:1305)
              at java.util.Calendar.get(Calendar.java:1088)
              at LeapYear.main(LeapYear.java:13)
       

       (4) Set the date of your PC to 12-31-2004
       (5) Launch "java LeapYear"
          ==> You will see the same exception.
       (6) Set the date of your PC to teh date other than 2/29 and 12/31
           on leap year.
       (7) Launch "java LeapYear"
          ==> You don't see the exception.


      NOTE:

        - This exception shows up on 2/29/2004, 12/31/2004 and same days on leapyear
          in 1.5.0-beta2.
        - The exception does not occur in 1.4.X.
          So, thas seems regression.


      CONFIGURATION :
        OS : WindowsXP(SP1, Japanese)
        JRE/JDK : 1.5.0-beta-b37(and 1.3.1)
      K:\temp>java -version
      java version "1.5.0-beta2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b37)
      Java HotSpot(TM) Client VM (build 1.5.0-beta2-b37, mixed mode)

       
      ==============================================================================

            okutsu Masayoshi Okutsu
            tbaba Tadayuki Baba (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: