-
Notifications
You must be signed in to change notification settings - Fork 109
Java21 recipe deprecatedSecurityManager #669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java21 recipe deprecatedSecurityManager #669
Conversation
src/main/java/org/openrewrite/java/migrate/DeprecatedSecurityManager.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/migrate/DeprecatedSecurityManager.java
Show resolved
Hide resolved
…anager.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…/ranuradh/rewrite-migrate-java into recipe_deprecatedSecurityManager
|
Is adding a |
|
Hi @MBoegers thanks for the feedback, I based my recipe on https://bugs.openjdk.org/browse/JDK-8271301) where |
|
I understand and your path. I have to gig a little deeper, what's the ultimate migration path. |
|
I"m not sure this approach would work; effectively you'd be trying to set a system property from a Java process that has already started, whereas I think this property should be set before the Java process is started. I don't think this is a change we can make a source-level adjustment for; this should change in the way the Java process is invoked after a migration to Java 21+. That's how I interpret the "Unless the system property is set to allow on the command line" above. I'd lean towards not having this as a recipe, as much as we appreciate the effort you've put in. |
|
Got it thanks will close the PR |
What's changed?
Java 21 recipe: org.openrewrite.java.migrate.DeprecatedSecurityManager
What's your motivation?
The default value of the java.security.manager system property has been changed to disallow since Java 18. Unless the system property is set to allow on the command line, any invocation of System.setSecurityManager(SecurityManager) with a non-null argument will throw an UnsupportedOperationException. You can set system property as Djava.security.manager=allow.
This recipe calls
System.setProperty("java.security.manager", "allow");whenever
System.setSecurityManager(SecurityManager) is called
Reference : https://bugs.openjdk.org/browse/JDK-8271301 & https://bugs.openjdk.org/browse/JDK-8270380
Anyone you would like to review specifically?
@timtebeek
Checklist