RFR: 8333344: JMX attaching of Subject does not work when security manager not allowed [v6]

Daniel Fuchs dfuchs at openjdk.org
Wed Jun 12 16:56:15 UTC 2024


On Wed, 12 Jun 2024 16:11:28 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

>> JMX uses APIs related to the Security Mananger which are deprecated.  Use of AccessControlContext will be removed when Security Manager is removed.
>> 
>> Until then, updates are needed to not require setting  -Djava.security.manager=allow to use JMX authentication.
>
> Kevin Walls has updated the pull request incrementally with one additional commit since the last revision:
> 
>    Undo test policy updates

src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java line 1445:

> 1443:             } else {
> 1444:                 throw new PrivilegedActionException(e);
> 1445:             }

I assume there no chance that `Exception e` may already be a `PrivilegedActionException` here. You coud avoid casts by using instanceof patterns.

Suggestion:

            if (e instanceof RuntimeException rte) {
                throw  rte;
            } else {
                throw new PrivilegedActionException(e);
            }

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19624#discussion_r1636791497


More information about the serviceability-dev mailing list