glassfish
  1. glassfish
  2. GLASSFISH-20686

DynamicInterceptor.createMBean() throws wrong Exception

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.1
    • Component/s: other
    • Labels:
      None
    • Environment:

      Windows x64.

      Description

      I found a bug earlier today trying to create an MBean in GlassFish. The "strange" method is com.sun.enterprise.v3.admin.DynamicInterceptor.createMBean(). When trying to create an MBean that already exists in the server I expected an InstanceAlreadyExistsException, but instead I got an MBeanException. This MBeanException had InstanceAlreadyExistsException as targetException/cause.

      According to the API I should get an InstanceAlreadyExistsException. Looking at the code it seems like the last lines catches all Exceptions and throw an MBeanException. It seems like if one of the functions called inside the try-block throws an InstanceAlreadyExistsException, it should just be passed on and not thrown as the cause of an MBeanException.

        Activity

        Hide
        Tim Quinn added a comment -

        Fix checked in.

        Project: glassfish
        Repository: svn
        Revision: 62419
        Author: tjquinn
        Date: 2013-07-26 16:09:00 UTC
        Link:

        Log Message:
        ------------
        Fix for GLASSFISH-20686

        Attempting to create an MBean with a name that is already used should trigger an InstanceAlreadyExistsException, but the exception handling in DynamicInterceptor.createMBean incorrectly wrapped all exceptions inside an MBeanException.

        This change uses more selective exception handling to let InstanceAlreadyExistsExceptions be thrown.

        Tests: RQ, manual tests

        Revisions:
        ----------
        62419

        Modified Paths:
        ---------------
        trunk/main/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/admin/DynamicInterceptor.java

        Show
        Tim Quinn added a comment - Fix checked in. Project: glassfish Repository: svn Revision: 62419 Author: tjquinn Date: 2013-07-26 16:09:00 UTC Link: Log Message: ------------ Fix for GLASSFISH-20686 Attempting to create an MBean with a name that is already used should trigger an InstanceAlreadyExistsException, but the exception handling in DynamicInterceptor.createMBean incorrectly wrapped all exceptions inside an MBeanException. This change uses more selective exception handling to let InstanceAlreadyExistsExceptions be thrown. Tests: RQ, manual tests Revisions: ---------- 62419 Modified Paths: --------------- trunk/main/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/admin/DynamicInterceptor.java
        Hide
        Tim Quinn added a comment -

        Your diagnosis looks exactly right.

        In fact there are four createMBean methods there which parallel the four createMBean methods on the MBeanServer interface, and all four have the same problem.

        Show
        Tim Quinn added a comment - Your diagnosis looks exactly right. In fact there are four createMBean methods there which parallel the four createMBean methods on the MBeanServer interface, and all four have the same problem.

          People

          • Assignee:
            Tim Quinn
            Reporter:
            davidlindholm
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: