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

java.util.Date constructor works wrong if parameters are outside indicated range

XMLWordPrintable

    • 1.1
    • sparc
    • solaris_2.5
    • Not verified

      java.util.Date constructor works wrong if
      one of parameters is outside the indicated range.

      Java language specification says (see item 21.3):
      "In all cases, arguments given to methods for these
      purposes need not fall within the indicated ranges;
      for example, a date may be specified as January 32 and
      is interpreted as meaning February 1"

      -------- Here is the minimizing test demonstrating this bug:

      class java_util_Date {
        public static void main (String args[]) {
          System.out.println(
            new java.util.Date(70,0,1,20,1,180)
          ); //should print "Thu Jan 01 20:04:00 PST 1970"
        }
      }
      -------- Here is the output of the test:
      Thu Jan 01 19:59:44 PST 1970

            duke J. Duke
            mgorshen Mikhail Gorshenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: