src/hotspot/share/prims/jni.cpp
changeset 50601 3fbae7b9ddb5
parent 50429 83aec1d357d4
child 51467 12997ebbc0d8
--- a/src/hotspot/share/prims/jni.cpp	Sat Jun 16 07:05:09 2018 +0200
+++ b/src/hotspot/share/prims/jni.cpp	Fri Jun 15 12:25:53 2018 +0200
@@ -2630,7 +2630,17 @@
     if (v == NULL || v->is_a(ObjArrayKlass::cast(a->klass())->element_klass())) {
       a->obj_at_put(index, v);
     } else {
-      THROW(vmSymbols::java_lang_ArrayStoreException());
+      ResourceMark rm(THREAD);
+      stringStream ss;
+      Klass *bottom_kl = ObjArrayKlass::cast(a->klass())->bottom_klass();
+      ss.print("type mismatch: can not store %s to %s[%d]",
+               v->klass()->external_name(),
+               bottom_kl->is_typeArray_klass() ? type2name_tab[ArrayKlass::cast(bottom_kl)->element_type()] : bottom_kl->external_name(),
+               index);
+      for (int dims = ArrayKlass::cast(a->klass())->dimension(); dims > 1; --dims) {
+        ss.print("[]");
+      }
+      THROW_MSG(vmSymbols::java_lang_ArrayStoreException(), ss.as_string());
     }
   } else {
     char buf[jintAsStringSize];