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

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

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      Not verified

      Description

      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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: