< prev index next >

src/java.base/share/native/libjli/java.c

Print this page
rev 50671 : [mq]: validate-modules


 424     // show resolved modules and continue
 425     if (showResolvedModules) {
 426         ShowResolvedModules(env);
 427         CHECK_EXCEPTION_LEAVE(1);
 428     }
 429 
 430     // list observable modules, then exit
 431     if (listModules) {
 432         ListModules(env);
 433         CHECK_EXCEPTION_LEAVE(1);
 434         LEAVE();
 435     }
 436 
 437     // describe a module, then exit
 438     if (describeModule != NULL) {
 439         DescribeModule(env, describeModule);
 440         CHECK_EXCEPTION_LEAVE(1);
 441         LEAVE();
 442     }
 443 
 444     // validate modules on the module path, then exit
 445     if (validateModules) {
 446         jboolean okay = ValidateModules(env);
 447         CHECK_EXCEPTION_LEAVE(1);
 448         if (!okay) ret = 1;
 449         LEAVE();
 450     }
 451 
 452     if (printVersion || showVersion) {
 453         PrintJavaVersion(env, showVersion);
 454         CHECK_EXCEPTION_LEAVE(0);
 455         if (printVersion) {
 456             LEAVE();
 457         }
 458     }
 459 





 460     /* If the user specified neither a class name nor a JAR file */
 461     if (printXUsage || printUsage || what == 0 || mode == LM_UNKNOWN) {
 462         PrintUsage(env, printXUsage);
 463         CHECK_EXCEPTION_LEAVE(1);
 464         LEAVE();
 465     }
 466 
 467     FreeKnownVMs(); /* after last possible PrintUsage */
 468 
 469     if (JLI_IsTraceLauncher()) {
 470         end = CounterGet();
 471         JLI_TraceLauncher("%ld micro seconds to InitializeJVM\n",
 472                (long)(jint)Counter2Micros(end-start));
 473     }
 474 
 475     /* At this stage, argc/argv have the application's arguments */
 476     if (JLI_IsTraceLauncher()){
 477         int i;
 478         printf("%s is '%s'\n", launchModeNames[mode], what);
 479         printf("App's argc is %d\n", argc);


1938             "listModules", "()V"));
1939     (*env)->CallStaticVoidMethod(env, cls, listModulesID);
1940 }
1941 
1942 /**
1943  * Describe a module
1944  */
1945 static void
1946 DescribeModule(JNIEnv *env, char *optString)
1947 {
1948     jmethodID describeModuleID;
1949     jstring joptString = NULL;
1950     jclass cls = GetLauncherHelperClass(env);
1951     NULL_CHECK(cls);
1952     NULL_CHECK(describeModuleID = (*env)->GetStaticMethodID(env, cls,
1953             "describeModule", "(Ljava/lang/String;)V"));
1954     NULL_CHECK(joptString = (*env)->NewStringUTF(env, optString));
1955     (*env)->CallStaticVoidMethod(env, cls, describeModuleID, joptString);
1956 }
1957 
1958 /**
1959  * Validate modules
1960  */
1961 static jboolean
1962 ValidateModules(JNIEnv *env)
1963 {
1964     jmethodID validateModulesID;
1965     jclass cls = GetLauncherHelperClass(env);
1966     NULL_CHECK_RETURN_VALUE(cls, JNI_FALSE);
1967     validateModulesID = (*env)->GetStaticMethodID(env, cls, "validateModules", "()Z");
1968     NULL_CHECK_RETURN_VALUE(cls, JNI_FALSE);
1969     return (*env)->CallStaticBooleanMethod(env, cls, validateModulesID);
1970 }
1971 
1972 /*
1973  * Prints default usage or the Xusage message, see sun.launcher.LauncherHelper.java
1974  */
1975 static void
1976 PrintUsage(JNIEnv* env, jboolean doXUsage)
1977 {
1978   jmethodID initHelp, vmSelect, vmSynonym, printHelp, printXUsageMessage;
1979   jstring jprogname, vm1, vm2;
1980   int i;
1981   jclass cls = GetLauncherHelperClass(env);
1982   NULL_CHECK(cls);
1983   if (doXUsage) {
1984     NULL_CHECK(printXUsageMessage = (*env)->GetStaticMethodID(env, cls,
1985                                         "printXUsageMessage", "(Z)V"));
1986     (*env)->CallStaticVoidMethod(env, cls, printXUsageMessage, printTo);
1987   } else {
1988     NULL_CHECK(initHelp = (*env)->GetStaticMethodID(env, cls,
1989                                         "initHelpMessage", "(Ljava/lang/String;)V"));
1990 
1991     NULL_CHECK(vmSelect = (*env)->GetStaticMethodID(env, cls, "appendVmSelectMessage",




 424     // show resolved modules and continue
 425     if (showResolvedModules) {
 426         ShowResolvedModules(env);
 427         CHECK_EXCEPTION_LEAVE(1);
 428     }
 429 
 430     // list observable modules, then exit
 431     if (listModules) {
 432         ListModules(env);
 433         CHECK_EXCEPTION_LEAVE(1);
 434         LEAVE();
 435     }
 436 
 437     // describe a module, then exit
 438     if (describeModule != NULL) {
 439         DescribeModule(env, describeModule);
 440         CHECK_EXCEPTION_LEAVE(1);
 441         LEAVE();
 442     }
 443 








 444     if (printVersion || showVersion) {
 445         PrintJavaVersion(env, showVersion);
 446         CHECK_EXCEPTION_LEAVE(0);
 447         if (printVersion) {
 448             LEAVE();
 449         }
 450     }
 451 
 452     // modules have been validated at startup so exit
 453     if (validateModules) {
 454         LEAVE();
 455     }
 456 
 457     /* If the user specified neither a class name nor a JAR file */
 458     if (printXUsage || printUsage || what == 0 || mode == LM_UNKNOWN) {
 459         PrintUsage(env, printXUsage);
 460         CHECK_EXCEPTION_LEAVE(1);
 461         LEAVE();
 462     }
 463 
 464     FreeKnownVMs(); /* after last possible PrintUsage */
 465 
 466     if (JLI_IsTraceLauncher()) {
 467         end = CounterGet();
 468         JLI_TraceLauncher("%ld micro seconds to InitializeJVM\n",
 469                (long)(jint)Counter2Micros(end-start));
 470     }
 471 
 472     /* At this stage, argc/argv have the application's arguments */
 473     if (JLI_IsTraceLauncher()){
 474         int i;
 475         printf("%s is '%s'\n", launchModeNames[mode], what);
 476         printf("App's argc is %d\n", argc);


1935             "listModules", "()V"));
1936     (*env)->CallStaticVoidMethod(env, cls, listModulesID);
1937 }
1938 
1939 /**
1940  * Describe a module
1941  */
1942 static void
1943 DescribeModule(JNIEnv *env, char *optString)
1944 {
1945     jmethodID describeModuleID;
1946     jstring joptString = NULL;
1947     jclass cls = GetLauncherHelperClass(env);
1948     NULL_CHECK(cls);
1949     NULL_CHECK(describeModuleID = (*env)->GetStaticMethodID(env, cls,
1950             "describeModule", "(Ljava/lang/String;)V"));
1951     NULL_CHECK(joptString = (*env)->NewStringUTF(env, optString));
1952     (*env)->CallStaticVoidMethod(env, cls, describeModuleID, joptString);
1953 }
1954 














1955 /*
1956  * Prints default usage or the Xusage message, see sun.launcher.LauncherHelper.java
1957  */
1958 static void
1959 PrintUsage(JNIEnv* env, jboolean doXUsage)
1960 {
1961   jmethodID initHelp, vmSelect, vmSynonym, printHelp, printXUsageMessage;
1962   jstring jprogname, vm1, vm2;
1963   int i;
1964   jclass cls = GetLauncherHelperClass(env);
1965   NULL_CHECK(cls);
1966   if (doXUsage) {
1967     NULL_CHECK(printXUsageMessage = (*env)->GetStaticMethodID(env, cls,
1968                                         "printXUsageMessage", "(Z)V"));
1969     (*env)->CallStaticVoidMethod(env, cls, printXUsageMessage, printTo);
1970   } else {
1971     NULL_CHECK(initHelp = (*env)->GetStaticMethodID(env, cls,
1972                                         "initHelpMessage", "(Ljava/lang/String;)V"));
1973 
1974     NULL_CHECK(vmSelect = (*env)->GetStaticMethodID(env, cls, "appendVmSelectMessage",


< prev index next >