Skip to content

Commit 132d734

Browse files
authored
Merge pull request #18402 from pshipton/disallow
jdk8,11 Ignore "allow" and "disallow" set in java.security.manager
2 parents 4acf608 + ac93c29 commit 132d734

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

jcl/src/java.base/share/classes/java/lang/System.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,18 +1188,21 @@ static void checkTmpDir() {
11881188

11891189
static void initSecurityManager(ClassLoader applicationClassLoader) {
11901190
String javaSecurityManager = internalGetProperties().getProperty("java.security.manager"); //$NON-NLS-1$
1191-
/*[IF JAVA_SPEC_VERSION > 11]*/
1192-
if ("allow".equals(javaSecurityManager)) {
1193-
/* Do nothing. */
1194-
} else if ("disallow".equals(javaSecurityManager) //$NON-NLS-1$
1191+
if (null == javaSecurityManager) {
11951192
/*[IF JAVA_SPEC_VERSION >= 18]*/
1196-
|| (null == javaSecurityManager)
1193+
throwUOEFromSetSM = true;
1194+
/*[ELSE] JAVA_SPEC_VERSION >= 18 */
1195+
/* Do nothing. */
11971196
/*[ENDIF] JAVA_SPEC_VERSION >= 18 */
1198-
) {
1197+
} else if ("allow".equals(javaSecurityManager)) { //$NON-NLS-1$
1198+
/* Do nothing. */
1199+
} else if ("disallow".equals(javaSecurityManager)) { //$NON-NLS-1$
1200+
/*[IF JAVA_SPEC_VERSION > 11]*/
11991201
throwUOEFromSetSM = true;
1200-
} else
1201-
/*[ENDIF] JAVA_SPEC_VERSION > 11 */
1202-
if (null != javaSecurityManager) {
1202+
/*[ELSE] JAVA_SPEC_VERSION > 11 */
1203+
/* Do nothing. */
1204+
/*[ENDIF] JAVA_SPEC_VERSION > 11 */
1205+
} else {
12031206
/*[IF JAVA_SPEC_VERSION >= 17]*/
12041207
initialErr.println("WARNING: A command line option has enabled the Security Manager"); //$NON-NLS-1$
12051208
initialErr.println("WARNING: The Security Manager is deprecated and will be removed in a future release"); //$NON-NLS-1$

0 commit comments

Comments
 (0)