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

HS1.4: No exception thrown for the method java.lang.System.arraycopy

XMLWordPrintable

    • beta
    • sparc
    • solaris_8
    • Verified



      Name: elR10090 Date: 03/22/2001



      32-bit client java HotSpot VM (build 1.4.0-beta-b56) fails to pass the test

          nsk/regression/b4257171
          
      on Solaris Sparc in -Xcomp mode.

      The test passes on all other platforms and modes.
          
      Due to the specification for the method
      java.lang.System.arraycopy(java.lang.Object, int, java.lang.Object, int, int)

          "...
           an IndexOutOfBoundsException is thrown and the destination is not modified:
             - The srcOffset argument is negative.
             - The dstOffset argument is negative.
             - The length argument is negative.
             - srcOffset+length is greater than src.length,
               the length of the source array.
             - dstOffset+length is greater than dst.length,
               the length of the destination array."
               
          "...
           Throws:
           ArrayIndexOutOfBoundsException - if copying would cause access of
                                            data outside array bounds.
           ArrayStoreException - if an element in the src array could not be
                                 stored into the dest array because of a type
                                 mismatch.
           NullPointerException - if either src or dst is null."
           
      The spec does not clarify what exception will be thrown if
      srcOffset equals to Integer.MAX_VALUE and length > 0.

      Anyway, the following test expects ArrayIndexOutOfBoundsException,
      but neither IndexOutOfBoundsException, nor ArrayIndexOutOfBoundsException
      is thrown.

      import java.io.PrintStream;

      public class b4257171 {

          public static void main(String argv[]) {
      System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
          }

          public static int run(String argv[], PrintStream out) {
      int a1[] = {1, 2, 3};
      int a2[] = {4, 5, 6};
      try {
      System.arraycopy(a1, Integer.MAX_VALUE, a2, 0, 3);
      } catch (ArrayIndexOutOfBoundsException e) {
      return 0/*STATUS_PASSED*/;
      }
      return 2/*STATUS_FAILED*/;
          }

      }

      The failure looks like a regression of the known bug

          4257171: Client VM crashes while doing System.arraycopy
          
      The test belongs to the testbase_nsk testbase located at:

          /net/sqesvr.eng/export/vsn/VM/merlin/testbase/testbase_nsk

      ======================================================================

            never Tom Rodriguez
            latkinsunw Latkin Latkin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: