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

Kevin Walls kevinw at openjdk.org
Mon Jun 17 09:36:33 UTC 2024


On Sun, 16 Jun 2024 01:54:34 GMT, Weijun Wang <weijun at openjdk.org> wrote:

>> Kevin Walls has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Unnecessary catches to remove
>
> src/java.management/share/classes/javax/management/monitor/Monitor.java line 1542:
> 
>> 1540:             if (!SharedSecrets.getJavaLangAccess().allowSecurityManager()) {
>> 1541:                 // No SecurityManager permitted:
>> 1542:                 Subject.doAs(s, action); // s is permitted to be null
> 
> While `s` is permitted to be null, calling `Subject.doAs(null, action)` actually sets the current subject to null while calling `action`. This is not same as directly calling `action` where the current subject (could be non null) is used.

Yes, good point, got it. 8-)

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

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


More information about the serviceability-dev mailing list