@@ -212,6 +212,7 @@ UDATA runJVMOnLoad (J9JavaVM* vm, J9VMDllLoadInfo* loadInfo, char* options);
212
212
static IDATA updateJavaAgentClasspath (J9JavaVM * vm );
213
213
#endif /* J9VM_OPT_JVMTI */
214
214
static void consumeVMArgs (J9JavaVM * vm , J9VMInitArgs * j9vm_args );
215
+ static BOOLEAN isEmpty (const char * str );
215
216
216
217
#if (defined(J9VM_OPT_SIDECAR ))
217
218
static UDATA initializeJVMExtensionInterface (J9JavaVM * vm );
@@ -2392,9 +2393,10 @@ static UDATA checkArgsConsumed(J9PortLibrary* portLibrary, J9VMInitArgs* j9vm_ar
2392
2393
if (IS_CONSUMABLE ( j9vm_args , i ) && !IS_CONSUMED ( j9vm_args , i )) {
2393
2394
char * optString = j9vm_args -> actualVMArgs -> options [i ].optionString ;
2394
2395
char * envVar = j9vm_args -> j9Options [i ].fromEnvVar ;
2395
-
2396
- /* If ignoreUnrecognized is set to JNI_TRUE, we should not reject any unrecognized options beginning with -X or _ */
2397
- if (ignoreUnrecognized && optString && (!strncmp (optString , "-X" , 2 ) || * optString == '_' )) {
2396
+
2397
+ /* If ignoreUnrecognized is set to JNI_TRUE, we should not reject any options that are:
2398
+ empty or contain only whitespace, or unrecognized options beginning with -X or _ */
2399
+ if (ignoreUnrecognized && (NULL != optString ) && (isEmpty (optString ) || !strncmp (optString , "-X" , 2 ) || * optString == '_' )) {
2398
2400
continue ;
2399
2401
}
2400
2402
if (REQUIRES_LIBRARY ( j9vm_args , i )) {
@@ -2421,6 +2423,18 @@ static UDATA checkArgsConsumed(J9PortLibrary* portLibrary, J9VMInitArgs* j9vm_ar
2421
2423
return TRUE;
2422
2424
}
2423
2425
2426
+ /* Returns TRUE if a string is empty or if it contains only whitespace characters. */
2427
+ static BOOLEAN isEmpty (const char * str ) {
2428
+ BOOLEAN isEmpty = TRUE;
2429
+ while ('\0' != * str ) {
2430
+ if (0 == isspace ((unsigned char ) * str )) {
2431
+ isEmpty = FALSE;
2432
+ break ;
2433
+ }
2434
+ str ++ ;
2435
+ }
2436
+ return isEmpty ;
2437
+ }
2424
2438
2425
2439
/* Run using a pool_do after each initialization stage. If any errors were reported by libraries,
2426
2440
a flag is set to FALSE and the error is printed. See checkPostStage. */
0 commit comments