mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8201593: Print array length in ArrayIndexOutOfBoundsException
Reviewed-by: dholmes, mdoerr, smonteith, shade, rriggs
This commit is contained in:
parent
b812ae6e51
commit
ac3043c692
34 changed files with 675 additions and 142 deletions
|
@ -641,10 +641,12 @@ address Runtime1::exception_handler_for_pc(JavaThread* thread) {
|
|||
}
|
||||
|
||||
|
||||
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);
|
||||
const int len = 35;
|
||||
assert(len < strlen("Index %d out of bounds for length %d"), "Must allocate more space for message.");
|
||||
char message[2 * jintAsStringSize + len];
|
||||
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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue