< prev index next >

src/hotspot/share/c1/c1_Runtime1.cpp

Print this page
rev 49869 : 8201593: Print array length in ArrayIndexOutOfBoundsException.
Reviewed-by: dholmes

@@ -625,14 +625,14 @@
   assert(continuation != NULL, "no handler found");
   return continuation;
 }
 
 
-JRT_ENTRY(void, Runtime1::throw_range_check_exception(JavaThread* thread, int index))
+JRT_ENTRY(void, Runtime1::throw_range_check_exception(JavaThread* thread, int index, arrayOopDesc* a))
   NOT_PRODUCT(_throw_range_check_exception_count++;)
-  char message[jintAsStringSize];
-  sprintf(message, "%d", index);
+  char message[2 * jintAsStringSize + strlen("Index %d out-of-bounds for length %d.")];
+  sprintf(message, "Index %d out-of-bounds for length %d.", index, a->length());
   SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message);
 JRT_END
 
 
 JRT_ENTRY(void, Runtime1::throw_index_exception(JavaThread* thread, int index))
< prev index next >