8261785: Calling "main" method in anonymous nested class crashes the JVM

Reviewed-by: serb
This commit is contained in:
Henry Jen 2021-03-22 15:59:49 +00:00
parent 840ab7bf0f
commit b2df51372f
3 changed files with 143 additions and 1 deletions

View file

@ -827,7 +827,7 @@ SetMainClassForAWT(JNIEnv *env, jclass mainClass) {
NULL_CHECK(getCanonicalNameMID = (*env)->GetMethodID(env, classClass, "getCanonicalName", "()Ljava/lang/String;"));
jstring mainClassString = (*env)->CallObjectMethod(env, mainClass, getCanonicalNameMID);
if ((*env)->ExceptionCheck(env)) {
if ((*env)->ExceptionCheck(env) || NULL == mainClassString) {
/*
* Clears all errors caused by getCanonicalName() on the mainclass and
* leaves the JAVA_MAIN_CLASS__<pid> empty.