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

Daniel Fuchs dfuchs at openjdk.org
Thu May 16 10:32:03 UTC 2024


On Thu, 16 May 2024 10:16:58 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

>> Well my thinking was this: the fact that the jconsole tab was blank shows that the array may being passed. The previous code verified that all three arrays had the same length - so it would have failed if the array had a length different than the other two. So I would prefer if we kept on throwing in that case. In other words, we now allow and prefer `null` - but if non-null - we will allow a null-filled array passed by an older client but  we should not accept something that would have been invalid then.
>
> That the JConsole tab was blank shows that the older RMIConnector's addListenerWithSubject creates a new single-entry array from the given delegationSubject (which is null) and passes it onwards.  The app is not creating the array itself., that's us.
> 
> (also, maybe that JConsole relies on listeners in order to show a screen that doesn't really need to depend on them, but this change is obviously about being compatible with that)
> 
> We all know that that is the only use case out there, the current wisdom is that this feature is not used, nobody is creating the Subject array and calling addListenersWithSubjects (plural) with it...
> 
> IF we find such an app app, we are going to ignore the array unless it contains a non-null entry.  This seems safe and efficient.  We are documenting that it should be null,  and it is weird to document a length requirement for something that should be null...  8-)

This shows that when SubjectDelegation was not used, a null-filled array of the same length as the two other arrays was expected before (in previous versions of the JDK where SubjectDelegation was supported, but in the case where it wasn't used). 
I am not suggesting to document the length requirement. The length requirement was enforced before and undocumented. I'm just suggesting that we allow null and null-filled but don't allow something (null filled array of wrong length) that would have been rejeceted in previous JDK versions. I would also suggest to check the length before the content - in case an array is supplied.

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

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


More information about the serviceability-dev mailing list