RFR: 8364227: MBeanServer registerMBean throws NPE
Kevin Walls
kevinw at openjdk.org
Wed Jul 30 12:42:52 UTC 2025
On Wed, 30 Jul 2025 11:53:59 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> I assume a CSR should be created to track the behavior change. I don't expect there is code catching IAE instead of RuntimeOperationsException for this scenario but it's possible.
>
> Are you planning to add a test?
Hi -
I wasn't assuming a CSR was needed, as this is making us meet the declared spec, not changing the spec. While it is a behaviour correction, DefaultMBeanServerInterceptor.java has 20 existing examples of the correct behaviour, throwing RuntimeOperationsException wrapping an IllegalArgumentException, so we are fitting an established pattern.
The existing RuntimeOperationsException throws suggest code may well exist that catches RuntimeOperationsException on MBeanserver methods. The problem is that today this method throws a "raw" NullPointerException. We probably don't exepct people to be catching that, although maybe catching something more general.
Some of our tests do catch ROE, although we have almost no testing of the existing nulls that cause RuntimeOperationsException. For that reason I was not planning to add a test.
(e.g. We have "test/jdk/javax/management/modelmbean/InfoSupportTest.java" which tests mmbi.setDescriptor with a null and verifies the RuntimeOperationsException contains IllegalArgumentException)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26548#issuecomment-3136140949
More information about the serviceability-dev
mailing list