8194937: Inconsistent behavior of --validate-modules when combined with -m and other options

Reviewed-by: mchung
This commit is contained in:
Alan Bateman 2018-06-21 18:56:35 +01:00
parent a6ac56a69e
commit 91d9f3fbe0
8 changed files with 378 additions and 270 deletions

View file

@ -441,14 +441,6 @@ JavaMain(void * _args)
LEAVE();
}
// validate modules on the module path, then exit
if (validateModules) {
jboolean okay = ValidateModules(env);
CHECK_EXCEPTION_LEAVE(1);
if (!okay) ret = 1;
LEAVE();
}
if (printVersion || showVersion) {
PrintJavaVersion(env, showVersion);
CHECK_EXCEPTION_LEAVE(0);
@ -457,6 +449,11 @@ JavaMain(void * _args)
}
}
// modules have been validated at startup so exit
if (validateModules) {
LEAVE();
}
/* If the user specified neither a class name nor a JAR file */
if (printXUsage || printUsage || what == 0 || mode == LM_UNKNOWN) {
PrintUsage(env, printXUsage);
@ -1955,20 +1952,6 @@ DescribeModule(JNIEnv *env, char *optString)
(*env)->CallStaticVoidMethod(env, cls, describeModuleID, joptString);
}
/**
* Validate modules
*/
static jboolean
ValidateModules(JNIEnv *env)
{
jmethodID validateModulesID;
jclass cls = GetLauncherHelperClass(env);
NULL_CHECK_RETURN_VALUE(cls, JNI_FALSE);
validateModulesID = (*env)->GetStaticMethodID(env, cls, "validateModules", "()Z");
NULL_CHECK_RETURN_VALUE(cls, JNI_FALSE);
return (*env)->CallStaticBooleanMethod(env, cls, validateModulesID);
}
/*
* Prints default usage or the Xusage message, see sun.launcher.LauncherHelper.java
*/