mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
6191224: (reflect) Misleading detail string in IllegalArgumentException thrown by Array.get<Type>
The test case shows that an exception is thrown with the message "Argument is not an array", when in fact the argument is an array, but an array of a primitive type is actually what was expected. Fixed by differentiating between failing because an array was expected and failing because an array of a primitive type was expected. Reviewed-by: dholmes, ctornqvi, lfoltan
This commit is contained in:
parent
1aa3da1067
commit
5306f2430a
2 changed files with 79 additions and 1 deletions
|
@ -3271,8 +3271,10 @@ static inline arrayOop check_array(JNIEnv *env, jobject arr, bool type_array_onl
|
|||
THROW_0(vmSymbols::java_lang_NullPointerException());
|
||||
}
|
||||
oop a = JNIHandles::resolve_non_null(arr);
|
||||
if (!a->is_array() || (type_array_only && !a->is_typeArray())) {
|
||||
if (!a->is_array()) {
|
||||
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Argument is not an array");
|
||||
} else if (type_array_only && !a->is_typeArray()) {
|
||||
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Argument is not an array of primitive type");
|
||||
}
|
||||
return arrayOop(a);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue