< prev index next >

src/hotspot/share/c1/c1_Runtime1.cpp

Print this page
rev 49887 : 8201593: Print array length in ArrayIndexOutOfBoundsException.
Reviewed-by: dholmes, mdoerr

*** 625,638 **** assert(continuation != NULL, "no handler found"); return continuation; } ! JRT_ENTRY(void, Runtime1::throw_range_check_exception(JavaThread* thread, int index)) NOT_PRODUCT(_throw_range_check_exception_count++;) ! char message[jintAsStringSize]; ! sprintf(message, "%d", index); 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)) --- 625,640 ---- assert(continuation != NULL, "no handler found"); return continuation; } ! JRT_ENTRY(void, Runtime1::throw_range_check_exception(JavaThread* thread, int index, arrayOopDesc* a)) NOT_PRODUCT(_throw_range_check_exception_count++;) ! 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 JRT_ENTRY(void, Runtime1::throw_index_exception(JavaThread* thread, int index))
< prev index next >