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

KESTREL-RC1: getActualMaximum() Problem on February 29

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.3.0
    • core-libs



      Name: stC104175 Date: 03/06/2000


      Java version 1.3.0rc1

      Compiling and executing the code below with the computer date set to February 29
      produces the following output:

      DAYS IN FEB 1999 ARE = 31
      DAYS IN FEB 2000 ARE = 31

      Process leaptest finished

      Whereas executing the code with the computer date set to any other "non-leap"
      day produces the correct output:

      DAYS IN FEB 1999 ARE = 28
      DAYS IN FEB 2000 ARE = 29

      Process leaptest finished

      This behavior seems to hold for other leap and non-leap years as well.


      -----------------CODE----------------------

      import java.lang.*;
      import java.util.*;

      public class leaptest
      {
          public static void main(String args[])
          {
      Calendar c = Calendar.getInstance();
      c.set(Calendar.YEAR, 1999);
      c.set(Calendar.MONTH, Calendar.FEBRUARY);
      System.out.println("DAYS IN FEB 1999 ARE = "
                              + c.getActualMaximum(Calendar.DAY_OF_MONTH));
      c.set(Calendar.YEAR, 2000);
      System.out.println("DAYS IN FEB 2000 ARE = " +
                               c.getActualMaximum(Calendar.DAY_OF_MONTH));
          }
      }
      (Review ID: 102048)
      ======================================================================

            okutsu Masayoshi Okutsu
            stompkinsunw Sean Tompkins (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: