Skip to content

Commit

Permalink
jdk8 Ignore "allow" and "disallow" set in java.security.manager
Browse files Browse the repository at this point in the history
This was previously attempted via
#18402 but it didn't work
for jdk8.

Issue #18900

Signed-off-by: Peter Shipton <[email protected]>
  • Loading branch information
pshipton committed Feb 9, 2024
1 parent 4a737ca commit c20fd9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions jcl/src/java.base/share/classes/java/lang/ClassLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ static final void initializeClassLoaders() {
System.initSecurityManager(applicationClassLoader);
jdk.internal.misc.VM.initLevel(3);
/*[ELSE] JAVA_SPEC_VERSION >= 9 */
String smvalue = System.internalGetProperties().getProperty("java.security.manager"); //$NON-NLS-1$
if ("allow".equals(smvalue) || "disallow".equals(smvalue)) { //$NON-NLS-1$ //$NON-NLS-2$
System.internalGetProperties().remove("java.security.manager"); //$NON-NLS-1$
}
applicationClassLoader = sun.misc.Launcher.getLauncher().getClassLoader();
/*[ENDIF] JAVA_SPEC_VERSION >= 9 */

Expand Down
2 changes: 2 additions & 0 deletions jcl/src/java.base/share/classes/java/lang/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,7 @@ static void checkTmpDir() {
/*[ENDIF] JAVA_SPEC_VERSION >= 20 */
}

/*[IF JAVA_SPEC_VERSION >= 9]*/
static void initSecurityManager(ClassLoader applicationClassLoader) {
String javaSecurityManager = internalGetProperties().getProperty("java.security.manager"); //$NON-NLS-1$
if (null == javaSecurityManager) {
Expand Down Expand Up @@ -1219,6 +1220,7 @@ static void initSecurityManager(ClassLoader applicationClassLoader) {
}
}
}
/*[ENDIF] JAVA_SPEC_VERSION >= 9 */

/**
* Sets the active security manager. Note that once
Expand Down

0 comments on commit c20fd9e

Please sign in to comment.