hotspot/src/share/vm/prims/jni.cpp
changeset 46431 87b0d1afe03e
parent 46369 3bf4544bec14
child 46589 f1c04490ded1
--- a/hotspot/src/share/vm/prims/jni.cpp	Wed May 03 18:44:27 2017 -0400
+++ b/hotspot/src/share/vm/prims/jni.cpp	Thu May 04 10:05:29 2017 -0400
@@ -325,7 +325,12 @@
     if (str_len > Symbol::max_length()) {
       // It's impossible to create this class;  the name cannot fit
       // into the constant pool.
-      THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), name);
+      Exceptions::fthrow(THREAD_AND_LOCATION,
+                         vmSymbols::java_lang_NoClassDefFoundError(),
+                         "Class name exceeds maximum length of %d: %s",
+                         Symbol::max_length(),
+                         name);
+      return 0;
     }
     class_name = SymbolTable::new_symbol(name, CHECK_NULL);
   }
@@ -378,8 +383,16 @@
 
   // Sanity check the name:  it cannot be null or larger than the maximum size
   // name we can fit in the constant pool.
-  if (name == NULL || (int)strlen(name) > Symbol::max_length()) {
-    THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), name);
+  if (name == NULL) {
+    THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), "No class name given");
+  }
+  if ((int)strlen(name) > Symbol::max_length()) {
+    Exceptions::fthrow(THREAD_AND_LOCATION,
+                       vmSymbols::java_lang_NoClassDefFoundError(),
+                       "Class name exceeds maximum length of %d: %s",
+                       Symbol::max_length(),
+                       name);
+    return 0;
   }
 
   //%note jni_3