src/java.base/macosx/native/libjli/java_md_macosx.c

Print this page

        

@@ -946,12 +946,15 @@
     NULL_CHECK(classClass = FindBootStrapClass(env, "java/lang/Class"));
 
     jmethodID getCanonicalNameMID = NULL;
     NULL_CHECK(getCanonicalNameMID = (*env)->GetMethodID(env, classClass, "getCanonicalName", "()Ljava/lang/String;"));
 
-    jstring mainClassString = NULL;
-    NULL_CHECK(mainClassString = (*env)->CallObjectMethod(env, mainClass, getCanonicalNameMID));
+    jstring mainClassString = (*env)->CallObjectMethod(env, mainClass, getCanonicalNameMID);
+    if ((*env)->ExceptionCheck(env)) {
+        (*env)->ExceptionClear(env);
+        return;
+    }
 
     const char *mainClassName = NULL;
     NULL_CHECK(mainClassName = (*env)->GetStringUTFChars(env, mainClassString, NULL));
 
     char envVar[80];

@@ -1054,11 +1057,11 @@
 
 /*
  * Note the jvmInstance must be initialized first before entering into
  * ShowSplashScreen, as there is a callback into the JLI_GetJavaVMInstance.
  */
-void PostJVMInit(JNIEnv *env, jstring mainClass, JavaVM *vm) {
+void PostJVMInit(JNIEnv *env, jclass mainClass, JavaVM *vm) {
     jvmInstance = vm;
     SetMainClassForAWT(env, mainClass);
     CHECK_EXCEPTION_RETURN();
     ShowSplashScreen();
 }