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

(coll spec) Vector.copyInto should document ArrayStoreException

XMLWordPrintable

      Name: rmT116609 Date: 10/13/2003


      A DESCRIPTION OF THE PROBLEM :
      When the runtime type of an argument is not a supertype of the runtime type of every element in this Vector, copyInto method of the vector class rightly and justifiably, throws java.lang.ArrayStoreException. BUT the API mentions only NullPointerException in the throws clause.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      copyInto
      public void copyInto(Object[] anArray)Copies the components of this vector into the specified array. The item at index k in this vector is copied into component k of anArray. The array must be big enough to hold all the objects in this vector, else an IndexOutOfBoundsException is thrown.

      Parameters:
      anArray - the array into which the components get copied.
      Throws:
      NullPointerException - if the given array is null.
      ArrayStoreException - if the runtime type of an argument is not a supertype of the runtime type of every element in this Vector.


      ACTUAL -
      copyInto
      public void copyInto(Object[] anArray)Copies the components of this vector into the specified array. The item at index k in this vector is copied into component k of anArray. The array must be big enough to hold all the objects in this vector, else an IndexOutOfBoundsException is thrown.

      Parameters:
      anArray - the array into which the components get copied.
      Throws:
      NullPointerException - if the given array is null.


      URL OF FAULTY DOCUMENTATION :
      http://java.sun.com/j2se/1.4.2/docs/api/java/util/Vector.html#copyInto(java.lang.Object[])
      (Incident Review ID: 214644)
      ======================================================================

            martin Martin Buchholz
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: