8152721: Java Web Start splash mechanism is not working in JDK9
authormchung
Tue, 31 May 2016 10:59:31 -0700
changeset 38753 9d4f778eda39
parent 38752 6f676cd6021e
child 38754 f6df9f195487
8152721: Java Web Start splash mechanism is not working in JDK9 Reviewed-by: alanb, ksrini
jdk/src/java.base/share/native/libjli/java.c
--- a/jdk/src/java.base/share/native/libjli/java.c	Tue May 31 13:43:15 2016 -0400
+++ b/jdk/src/java.base/share/native/libjli/java.c	Tue May 31 10:59:31 2016 -0700
@@ -108,6 +108,7 @@
 static void SetPatchProp(const jint n, const char *s);
 static void SelectVersion(int argc, char **argv, char **main_class);
 static void SetJvmEnvironment(int argc, char **argv);
+static jboolean IsWhiteSpaceOptionArgument(const char* name);
 static jboolean ParseArguments(int *pargc, char ***pargv,
                                int *pmode, char **pwhat,
                                int *pret, const char *jrepath);
@@ -500,6 +501,20 @@
 }
 
 /*
+ * Test if the given option name has a whitespace separated argument.
+ */
+jboolean
+IsWhiteSpaceOptionArgument(const char* name) {
+    return JLI_StrCmp(name, "-classpath") == 0 ||
+           JLI_StrCmp(name, "-cp") == 0 ||
+           JLI_StrCmp(name, "-modulepath") == 0 ||
+           JLI_StrCmp(name, "-mp") == 0 ||
+           JLI_StrCmp(name, "-upgrademodulepath") == 0 ||
+           JLI_StrCmp(name, "-addmods") == 0 ||
+           JLI_StrCmp(name, "-limitmods") == 0;
+}
+
+/*
  * Checks the command line options to find which JVM type was
  * specified.  If no command line option was given for the JVM type,
  * the default type is used.  The environment variable
@@ -534,13 +549,7 @@
                 continue;
             }
         } else {
-            if (JLI_StrCmp(arg, "-classpath") == 0 ||
-                JLI_StrCmp(arg, "-cp") == 0 ||
-                JLI_StrCmp(arg, "-modulepath") == 0 ||
-                JLI_StrCmp(arg, "-mp") == 0 ||
-                JLI_StrCmp(arg, "-upgrademodulepath") == 0 ||
-                JLI_StrCmp(arg, "-addmods") == 0 ||
-                JLI_StrCmp(arg, "-limitmods") == 0) {
+            if (IsWhiteSpaceOptionArgument(arg)) {
                 newArgv[newArgvIdx++] = arg;
                 argi++;
                 if (argi < argc) {
@@ -682,9 +691,7 @@
         if (i > 0) {
             char *prev = argv[i - 1];
             // skip non-dash arg preceded by class path specifiers
-            if (*arg != '-' &&
-                    ((JLI_StrCmp(prev, "-cp") == 0
-                    || JLI_StrCmp(prev, "-classpath") == 0))) {
+            if (*arg != '-' && IsWhiteSpaceOptionArgument(prev)) {
                 continue;
             }
 
@@ -1028,9 +1035,7 @@
         } else {
             if (JLI_StrCmp(arg, "-jar") == 0)
                 jarflag = 1;
-            /* deal with "unfortunate" classpath syntax */
-            if ((JLI_StrCmp(arg, "-classpath") == 0 || JLI_StrCmp(arg, "-cp") == 0) &&
-              (argc >= 2)) {
+            if (IsWhiteSpaceOptionArgument(arg) && (argc >= 2)) {
                 argc--;
                 argv++;
                 arg = *argv;