Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8364366

MBeanServer registerMBean throws NPE

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 26
    • core-svc
    • None
    • behavioral
    • minimal
    • It possible, but unlikely, that there is existing code that depends on the current broken behavior. No workaround/property to restore old behavior is proposed, it could be considered if issues arise.
    • Java API
    • SE

      Summary

      The javax.management.MBeanServer method registerMBean is changed to throw RuntimeOperationsException instead of NullPointerException when invoked with a null "object" parameter. The change aligns the implementation with the specification.

      Problem

      It is common in the javax.management.MBeanServer implementation for methods to check if parameters are null. Nulls are reported by throwing a RuntimeOperationsException, with an IllegalArgumentException as cause.

      The registerMBean method incorrectly throws NullPointerException if invoked with a null value for the "object" parameter.

      Solution

      Change the javax.management.MBeanServer method registerMBean to throw RuntimeOperationsException, with an IllegalArgumentException as the cause, when invoked with a null value for the "object" parameter.

      Specification

      No API or doc changes.

      Github PR for reference: https://github.com/openjdk/jdk/pull/26548

            kevinw Kevin Walls
            webbuggrp Webbug Group
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: