Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consider VM-configuration when determining if SecurityManager may be set
Since Java-12 users can configure a JVM to disallow the installation of a SecurityManager at runtime. The default value of the configuration has changed over the following versions and since Java-24 it's finally not possible anymore under any circumstances to install a SecurityManager at runtime (see JEP-486[1]). To quote from JEP-411[0]: """ Since Java 12, the end user has been able to prevent [dynamic installations of a Security Manager] by setting the system property java.security.manager to disallow on the command line (java -Djava.security.manager=disallow ...) -- this causes System::setSecurityManager to throw an UnsupportedOperationException. Starting in Java 18, the default value of java.security.manager will be disallow[...]. """ To determine if setting a SecurityManager is allowed, it's therefore not sufficient to just check the version of the running JVM, if it's a VM for Java-12 up to 23 (including). In case of the latter it has to be tested explicitly if setting a SecurityManager is supported. [0] - https://openjdk.org/jeps/411 [1] - https://openjdk.org/jeps/486
- Loading branch information