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

GregorianCalendar.isLeapYear(1000) returns incorrect value

XMLWordPrintable

    • b43
    • sparc
    • solaris_2.6
    • Verified



      Name: auR10023 Date: 12/09/2003


      Filed By : SPB JCK team (###@###.###)
      JDK : java full version "1.5.0-beta-b30"
      JCK : 1.5
      Platform[s] : Solaris
      switch/Mode :
      JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
      Failing Test [s] :
          api/java_util/GregorianCalendar/index.html#SetGet[GregorianCalendar0026]


      Problem description
      ===================
      java.util.GregorianCalendar.isLeapYear(1000) returns false with GMT offsets >= 10.
      Year 1000 is leap in both julian and gregorian calendars so this method should return true.


          
      Minimized test:
      ===============
      ------- Test.java -------
      import java.util.*;

      public class Test {
          public static void main (String [] args) {
              String tz [] = {"GMT+8", "GMT+9", "GMT+10", "GMT+11", "GMT+12"};
              for (int i = 0; i < tz.length; i++) {
                  GregorianCalendar calendar =
                      new GregorianCalendar(TimeZone.getTimeZone(tz[i]));
                  calendar.set(1001, 0, 1);
                  calendar.setGregorianChange(calendar.getTime());
                  System.out.println("calendar = GregorianCalendar(" +
                                     "TimeZone.getTimeZone(\"" +
                                     tz[i] + "\"))");
                  System.out.println("calendar.isLeapYear(1000) = " +
                                     calendar.isLeapYear(1000));
                  System.out.println();
              }
          }
      }

      ------- end-of-Test.java -------

      Minimized test output:
      ======================
      calendar = GregorianCalendar(TimeZone.getTimeZone("GMT+8"))
      calendar.isLeapYear(1000) = true

      calendar = GregorianCalendar(TimeZone.getTimeZone("GMT+9"))
      calendar.isLeapYear(1000) = true

      calendar = GregorianCalendar(TimeZone.getTimeZone("GMT+10"))
      calendar.isLeapYear(1000) = false

      calendar = GregorianCalendar(TimeZone.getTimeZone("GMT+11"))
      calendar.isLeapYear(1000) = false

      calendar = GregorianCalendar(TimeZone.getTimeZone("GMT+12"))
      calendar.isLeapYear(1000) = false


      JCK test source location:
      ==========================
      /java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests
          
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: