hotspot/src/share/vm/prims/jvm.cpp
changeset 46431 87b0d1afe03e
parent 46404 ae62ba99a1a7
child 46505 fd4bc78630b1
--- a/hotspot/src/share/vm/prims/jvm.cpp	Wed May 03 18:44:27 2017 -0400
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Thu May 04 10:05:29 2017 -0400
@@ -837,13 +837,22 @@
   return result;
 JVM_END
 
+// Currently only called from the old verifier.
 JVM_ENTRY(jclass, JVM_FindClassFromClass(JNIEnv *env, const char *name,
                                          jboolean init, jclass from))
   JVMWrapper("JVM_FindClassFromClass");
-  if (name == NULL || (int)strlen(name) > Symbol::max_length()) {
+  if (name == NULL) {
+    THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), "No class name given");
+  }
+  if ((int)strlen(name) > 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;
   }
   TempNewSymbol h_name = SymbolTable::new_symbol(name, CHECK_NULL);
   oop from_class_oop = JNIHandles::resolve(from);
@@ -919,7 +928,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, str_len, CHECK_NULL);
   }