Skip to content

Commit

Permalink
jdk8,11 Ignore "allow" and "disallow" set in java.security.manager
Browse files Browse the repository at this point in the history
Issue #18401

Signed-off-by: Peter Shipton <[email protected]>
  • Loading branch information
pshipton committed Nov 6, 2023
1 parent b614f6c commit ac93c29
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions jcl/src/java.base/share/classes/java/lang/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -1188,18 +1188,21 @@ static void checkTmpDir() {

static void initSecurityManager(ClassLoader applicationClassLoader) {
String javaSecurityManager = internalGetProperties().getProperty("java.security.manager"); //$NON-NLS-1$
/*[IF JAVA_SPEC_VERSION > 11]*/
if ("allow".equals(javaSecurityManager)) {
/* Do nothing. */
} else if ("disallow".equals(javaSecurityManager) //$NON-NLS-1$
if (null == javaSecurityManager) {
/*[IF JAVA_SPEC_VERSION >= 18]*/
|| (null == javaSecurityManager)
throwUOEFromSetSM = true;
/*[ELSE] JAVA_SPEC_VERSION >= 18 */
/* Do nothing. */
/*[ENDIF] JAVA_SPEC_VERSION >= 18 */
) {
} else if ("allow".equals(javaSecurityManager)) { //$NON-NLS-1$
/* Do nothing. */
} else if ("disallow".equals(javaSecurityManager)) { //$NON-NLS-1$
/*[IF JAVA_SPEC_VERSION > 11]*/
throwUOEFromSetSM = true;
} else
/*[ENDIF] JAVA_SPEC_VERSION > 11 */
if (null != javaSecurityManager) {
/*[ELSE] JAVA_SPEC_VERSION > 11 */
/* Do nothing. */
/*[ENDIF] JAVA_SPEC_VERSION > 11 */
} else {
/*[IF JAVA_SPEC_VERSION >= 17]*/
initialErr.println("WARNING: A command line option has enabled the Security Manager"); //$NON-NLS-1$
initialErr.println("WARNING: The Security Manager is deprecated and will be removed in a future release"); //$NON-NLS-1$
Expand Down

0 comments on commit ac93c29

Please sign in to comment.