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

Kevin Walls kevinw at openjdk.org
Wed Jun 12 14:09:16 UTC 2024


On Tue, 11 Jun 2024 20:31:03 GMT, Sean Mullan <mullan at openjdk.org> wrote:

>> src/java.management/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java line 350:
>> 
>>> 348:     @SuppressWarnings("removal")
>>> 349:     private Subject getSubject() {
>>> 350:         Subject subject = null;
>> 
>> Just call `Subject.current()`. When SM is allowed, it is equivalent to `getSubject(AccessController.getContext())`.
>
> For the same reason you should be able to just call `Subject.current` in the tests. I don't think you need the `SimpleStandard.useGetSubjectACC` property to toggle the testing of either old or replacement APIs as long as the test has runs in both SM allow and disallow (i.e., no SM prop set) modes. Would you agree Weijun?

I thought there was a comment elsewhere suggesting using SM=allow to test with Subject.getSubject() and Subject.current(), and when SM not allowed, to only use Subject.current() ?
That was the reason for the property in the tests.

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

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


More information about the core-libs-dev mailing list