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

MBeanRegistration.preRegister says exceptions can be wrapped two ways

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b42
    • CPU:
      generic
    • OS:
      generic

      Description

      The Javadoc for MBeanRegistration.preRegister says

      "Throws:
      Exception - This exception will be caught by the MBean server and re-thrown as an MBeanRegistrationException or a RuntimeMBeanException."

      It doesn't say when it will be one or the other. Furthermore, MBeanServer.createMBean doesn't declare that it can throw RuntimeMBeanException, even though it does declare RuntimeOperationsException (which is also a RuntimeException). The RI always wraps in MBeanRegistrationException, even when the original exception is a RuntimeException. The TCK tests for this behaviour. Thus, it would make sense for the spec to say that the exception is always wrapped in MBeanRegistrationException, and no longer mention RuntimeMBeanException in the doc for MBeanRegistration.preRegister.

      The PDF spec is unambiguous on the subject. P123 says:
      "This method might throw the MBeanRegistrationException that will be thrown again unchanged by the MBean server. Any other exception will be caught by the MBean server, encapsulated in an MBeanRegistrationException and thrown again."

        Attachments

          Activity

            People

            Assignee:
            emcmanus Eamonn McManus
            Reporter:
            emcmanus Eamonn McManus
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: