< prev index next >

src/hotspot/share/oops/objArrayKlass.cpp

Print this page

        

@@ -253,29 +253,32 @@
   if (src_pos < 0 || dst_pos < 0 || length < 0) {
     // Pass specific exception reason.
     ResourceMark rm;
     stringStream ss;
     if (src_pos < 0) {
-      ss.print("while trying to copy from index %i of an object array with length %i", src_pos, s->length());
+      ss.print("arraycopy source index %i out of bounds for object array[%i].",
+               src_pos, s->length());
     } else if (dst_pos < 0) {
-      ss.print("while trying to copy to index %i of an object array with length %i", dst_pos, d->length());
+      ss.print("arraycopy destination index %i out of bounds for object array[%i].",
+               dst_pos, d->length());
     } else {
-      ss.print("while trying to copy a negative range %i from an object array with length %i to an object array with length %i",
-        length, s->length(), d->length());
+      ss.print("arraycopy length %i is negative.", length);
     }
     THROW_MSG(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), ss.as_string());
   }
   // Check if the ranges are valid
-  if  ( (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length())
-     || (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) {
+  if ((((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length()) ||
+      (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length())) {
     // Pass specific exception reason.
     ResourceMark rm;
     stringStream ss;
     if (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length()) {
-      ss.print("while trying to copy from index %u of an object array with length %i", (unsigned int) length + (unsigned int) src_pos, s->length());
+      ss.print("arraycopy: last source index %u out of bounds for object array[%i].",
+               (unsigned int) length + (unsigned int) src_pos, s->length());
     } else {
-      ss.print("while trying to copy to index %u of an object array with length %i", (unsigned int) length + (unsigned int) dst_pos, d->length());
+      ss.print("arraycopy: last destination index %u out of bounds for object array[%i].",
+               (unsigned int) length + (unsigned int) dst_pos, d->length());
     }
     THROW_MSG(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), ss.as_string());
   }
 
   // Special case. Boundary cases must be checked first
< prev index next >