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

java.util.Date constructor throws ArrayIndexOutOfBoundsException

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5

      Description

      new java.util.Date(long) throws ArrayIndexOutOfBoundsException
      when argument is large (eg Long.MAX_VALUE or Long.MIN_VALUE).

      === Here is the test demonstrating the bug ===
      class java_sql_Timestamp4 {
        public static void main (String args[]) {
            java.util.Date d1 = new java.util.Date(Long.MAX_VALUE);
            System.out.println(d1);
        }
      }

      === Here is the output of the test ===
      java.lang.ArrayIndexOutOfBoundsException: 2147483633
      at java.util.GregorianCalendar.timeToFields(GregorianCalendar.java)
      at java.util.GregorianCalendar.computeFields(GregorianCalendar.java)
      at java.util.Date.<init>(Date.java)
      at java_sql_Timestamp4.main(java_sql_Timestamp4.java:3)

        Attachments

          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: