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

Gregorian calendar gives a java.lang.IllegalArgumentException only on 12-31-00

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P1 P1
    • 1.4.0
    • 1.2.2, 1.3.0, 1.3.1_09, 1.4.0
    • core-libs
    • None
    • beta
    • generic, x86, sparc
    • generic, solaris_7, windows_nt
    • Verified

        Gregorian calendar gives a java.lang.IllegalArgumentException only on 12-31-00.
        The exception arises even in jdk 1.3.0_01 and also jdk 1.2.2_06.

        TEST CASE FROM CUSTOMER
        =======================
        import java.util.*;

        public class GregCalBug {
          protected GregorianCalendar gc;

          public void run() {
            int nYear;

            gc = new GregorianCalendar();
            gc.setLenient(false); /* Bug only manifest if lenient set false */
            try
            {
              gc.set(2001, 1, 1, 1, 0, 0);
              nYear = gc.get(Calendar.YEAR);
            }
            catch (Exception ex)
            {
              System.out.println("We should _not_ be here!");
              System.out.println(ex);
            }
          }

          public static void main(String[] args) {
            System.out.println("This small Java class demonstrates a bug in");
            System.out.println("Solaris JVM JDK 1.2.1_04");
            GregCalBug me = new GregCalBug();
            me.run();
          }
        }

        Output of the above test case when date is set to 12-31-00.
        smala:/home/mala2/gregorian 62 % java -fullversion
        java full version "1.3.0_01"
        smala:/home/mala2/gregorian 63 % javac GregCalBug.java
        smala:/home/mala2/gregorian 64 % java GregCalBug
        This small Java class demonstrates a bug in
        Solaris JVM JDK 1.2.1_04
        We should _not_ be here!
        java.lang.IllegalArgumentException
        smala:/home/mala2/gregorian 65 %

              peytoia Yuka Kamiya (Inactive)
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: