glassfish
  1. glassfish
  2. GLASSFISH-3792

NPE in DynamicInterceptor.checkForIllegalMBean()

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 9.1peur1
    • Fix Version/s: 9.1peur1
    • Component/s: amx
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      3,792
    • Status Whiteboard:
      Hide

      91ur1Approved

      Show
      91ur1Approved

      Description

      Full version info is "Sun Java System Application Server 9.1 (build b58g-fcs)",
      i.e. the Glassfish bundled with NetBeans 6 dailies right now.

      It seems this version of this method assumes that the incoming ObjectName is
      non-null, while the Java API spec clearly states that it can be null. I leverage
      null input in my registration callbacks to have the MBean compute its own
      ObjectName – and this works in Sun Java Web Server 7, Tomcat 5 through 6, etc.

      A patch would be very much appreciated as this completely prevents my web
      application from loading.

        Activity

        Hide
        jess_holle added a comment -

        Stack trace:

        java.lang.NullPointerException
        at
        com.sun.enterprise.interceptor.DynamicInterceptor.checkForIllegalMBean(DynamicInterceptor.java:264)
        at
        com.sun.enterprise.interceptor.DynamicInterceptor.registerMBean(DynamicInterceptor.java:288)
        at wt.jmx.core.MBeanRegistry.registerMBean(MBeanRegistry.java:176)
        ...

        Note that as far as it is concerned my MBeanRegistry.registerMBean() is just
        calling the platform MBeanServer's registerMBean() method.

        Show
        jess_holle added a comment - Stack trace: java.lang.NullPointerException at com.sun.enterprise.interceptor.DynamicInterceptor.checkForIllegalMBean(DynamicInterceptor.java:264) at com.sun.enterprise.interceptor.DynamicInterceptor.registerMBean(DynamicInterceptor.java:288) at wt.jmx.core.MBeanRegistry.registerMBean(MBeanRegistry.java:176) ... Note that as far as it is concerned my MBeanRegistry.registerMBean() is just calling the platform MBeanServer's registerMBean() method.
        Hide
        jess_holle added a comment -

        I just downloaded the source and the patch is obvious (assuming someone didn't
        already address after this point).

        Just add:

        if ( objectName == null )
        return;

        right after

        if ( SPECIAL_CHECKS )
        {

        That's it.

        Any information as to when this fix will be in an official Glassfish release
        would be appreciated

        Show
        jess_holle added a comment - I just downloaded the source and the patch is obvious (assuming someone didn't already address after this point). Just add: if ( objectName == null ) return; right after if ( SPECIAL_CHECKS ) { That's it. Any information as to when this fix will be in an official Glassfish release would be appreciated
        Hide
        llc added a comment -

        Agreed that the spec allows null. A regrettable oversight on my part. I'm perfectly willing to fix this
        low-risk issue if approved for fixing.

        The suggested fix is better done by fixing registerMBean() to read:

        public final ObjectInstance registerMBean(final Object obj, final ObjectName objectName)
        throws NotCompliantMBeanException, MBeanRegistrationException,
        InstanceAlreadyExistsException
        {
        if (objectName != null )

        { checkForIllegalMBean( objectName ); }

        debug( "DynamicInterceptor.registerMBean: ", objectName, obj.getClass().getName() );
        return getDelegateMBeanServer().registerMBean( obj, objectName );
        }

        Show
        llc added a comment - Agreed that the spec allows null. A regrettable oversight on my part. I'm perfectly willing to fix this low-risk issue if approved for fixing. The suggested fix is better done by fixing registerMBean() to read: public final ObjectInstance registerMBean(final Object obj, final ObjectName objectName) throws NotCompliantMBeanException, MBeanRegistrationException, InstanceAlreadyExistsException { if (objectName != null ) { checkForIllegalMBean( objectName ); } debug( "DynamicInterceptor.registerMBean: ", objectName, obj.getClass().getName() ); return getDelegateMBeanServer().registerMBean( obj, objectName ); }
        Hide
        basler added a comment -

        Approved for check into the SJSAS91_UR1_BRANCH

        Show
        basler added a comment - Approved for check into the SJSAS91_UR1_BRANCH
        Hide
        basler added a comment -

        Moving to correct version

        Show
        basler added a comment - Moving to correct version
        Hide
        llc added a comment -

        QuickLook passes, diffs sent to admin@glassfish, ready to commit fix to cvs.

        Show
        llc added a comment - QuickLook passes, diffs sent to admin@glassfish, ready to commit fix to cvs.
        Hide
        llc added a comment -

        /cvs/glassfish/admin-core/admin/src/java/com/sun/enterprise/interceptor/DynamicInterceptor.java,v
        <-- DynamicInterceptor.java
        new revision: 1.4.8.1; previous revision: 1.4

        Show
        llc added a comment - /cvs/glassfish/admin-core/admin/src/java/com/sun/enterprise/interceptor/DynamicInterceptor.java,v <-- DynamicInterceptor.java new revision: 1.4.8.1; previous revision: 1.4

          People

          • Assignee:
            llc
            Reporter:
            jess_holle
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: