RFR: 8332303: Better JMX interoperability with older JDKs, after removing Subject Delegation

Kevin Walls kevinw at openjdk.org
Wed May 15 20:05:01 UTC 2024


On Wed, 15 May 2024 17:49:07 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Running JConsole from a previous JDK, and attaching to jdk-23 (after [JDK-8326666](https://bugs.openjdk.org/browse/JDK-8326666): Remove the Java Management Extension (JMX) Subject Delegation feature), the MBean tab is blank.
>> 
>> In javax/management/remote/rmi/RMIConnectionImpl.java:
>> addNotificationListener rejects a non-null delegationSubjects array, but older JDKs will send such an array. It could accept the array, and only reject/throw if it contains a non-null Subject (i.e. if an attempt to use subject delegation is really happening).
>> 
>> Manually testing JConsole, the MBean tab is fully populated and usable.
>
> src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java line 984:
> 
>> 982:         }
>> 983:         if (names.length != filters.length) {
>> 984:             final String msg = "The lengths of names and filters parameters are not same.";
> 
> I wonder if we should check that if present, `delegationSubjects.length == names.length`?

That seems pretty extreme -- it's an array we explicitly don't want and are going to ignore?  If somebody passes a non-null member, we will throw as unsupported.  I was thinking that was enough, hence removing the sbjs array to be quite certain we can't pass on any supplied Subjects.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19253#discussion_r1602181014


More information about the serviceability-dev mailing list