On Wed, 12 Jun 2024 20:52:51 GMT, Sean Mullan <mul...@openjdk.org> wrote:

>> Kevin Walls has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>    Undo test policy updates
>
> src/java.management/share/classes/javax/management/monitor/Monitor.java line 
> 1543:
> 
>> 1541:                 // No SecurityManager:
>> 1542:                 Subject.doAs(s, action); // s is permitted to be null
>> 1543:             } else {
> 
> Even though ac should never be null, I would keep the original check for ac 
> == null inside the SM code path to be safe and consistent with the original 
> code, and use only call doAs if allowSM is false, so like:
> 
> 
> if (!SharedSecrets.getJavaLangAccess().allowSecurityManager()) {
>     // No SecurityManager:
>     Subject.doAs(s, action); // s is permitted to be null
> } else {
>     if (ac == null) {
>         throw new SecurityException("AccessControlContext cannot be null");
>     }
>     // ACC means SM is permitted.
>     AccessController.doPrivileged(action, ac);
> }

ok done!

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

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

Reply via email to