admin@glassfish.java.net

Re: CODE REVIEW: minor bug fixes for 9.1.1 AMX unit test failures

From: Lloyd L Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Fri, 30 Nov 2007 15:48:16 -0800

Thanks Nandini.

For #2 ("bug in which the J2EEServer MBeanInfo has duplicate items in
it"), I've commented out the explicit code that modifies the default
MBeanInfo; it was merging additional items over the ones already in
the MBeanInfo. So I'm just removing code for that one.

See code below; it's commented out now. The problem call is
getMBeanInfo() which is merging additional infos into already
existing ones, creating duplicates. There is a slight difference
(Integer vs int, wrong per spec) and MBeanOperationInfo.ACTION, which
no one cares about. So it's safe to get rid of it.

Lloyd


/*
     private MBeanInfo mMBeanInfo = null;

                public synchronized MBeanInfo
        getMBeanInfo()
        {
         // compute the MBeanInfo only once!
         if ( mMBeanInfo == null )
         {
             final MBeanInfo superMBeanInfo = super.getMBeanInfo();
             mMBeanInfo = new MBeanInfo(
                 superMBeanInfo.getClassName(),
                 superMBeanInfo.getDescription(),
                 mergeAttributeInfos(superMBeanInfo.getAttributes(),
getMBeanAttributeInfo()),
                 superMBeanInfo.getConstructors(),
                 mergeOperationInfos(superMBeanInfo.getOperations(),
getMBeanOperationInfo()),
                 superMBeanInfo.getNotifications() );
         }
         return mMBeanInfo;
        }

                private MBeanAttributeInfo[]
        mergeAttributeInfos(
                MBeanAttributeInfo[] infos1,
                MBeanAttributeInfo[] infos2 )
        {
                final MBeanAttributeInfo[] infos =
                        new MBeanAttributeInfo[ infos1.length + infos2.length ];
                
                System.arraycopy( infos1, 0, infos, 0, infos1.length );
                System.arraycopy( infos2, 0, infos, infos1.length, infos2.length );
                
                return( infos );
        }


                private MBeanAttributeInfo[]
        getMBeanAttributeInfo()
        {
                MBeanAttributeInfo[] dAttributes = new MBeanAttributeInfo[1];
                dAttributes[0] = new MBeanAttributeInfo("state",
                                                 "java.lang.Integer",
                                                 "server state",
                                                 true,
                                                 false,
                                                 false);
                return dAttributes;
        }
*/


/* private MBeanOperationInfo[]
        mergeOperationInfos(
                MBeanOperationInfo[] infos1,
                MBeanOperationInfo[] infos2 )
        {
                final MBeanOperationInfo[] infos =
                        new MBeanOperationInfo[ infos1.length + infos2.length ];
                
                System.arraycopy( infos1, 0, infos, 0, infos1.length );
                System.arraycopy( infos2, 0, infos, infos1.length, infos2.length );
                
                return( infos );
        }
*/

/*
                private MBeanOperationInfo[]
        getMBeanOperationInfo()
        {
                MBeanOperationInfo[] dOperations = new MBeanOperationInfo[3];
                dOperations[0] = new MBeanOperationInfo("start",
                                                 "start server
instance",
                                                 null,
                                                 "void",
                                                  
MBeanOperationInfo.ACTION);
                dOperations[1] = new MBeanOperationInfo("stop",
                                                 "stop server instance",
                                                 null,
                                                 "void",
                                                  
MBeanOperationInfo.ACTION);
                dOperations[2] = new MBeanOperationInfo("startRecursive",
                                                 "start server
instance",
                                                 null,
                                                 "void",
                                                  
MBeanOperationInfo.ACTION);
                return dOperations;
        }
*/






On Nov 30, 2007, at 3:39 PM, Nandini Ektare wrote:

> Lloyd L Chambers wrote:
> This is for 9.1.1.
>
> These two fixes address AMX unit test failures:
>
> 1. A bug in which "jvm.log" is returned with the list of server
> log files.
> Looks fine.
> 2. A bug in which the J2EEServer MBeanInfo has duplicate items in it.
> Is that the output of cvs diff -u ? It's not easy to read those
> diffs. Seems like you have done fixes to mergeOperationInfos and
> mergeAttributeInfos.

---
Lloyd L Chambers
lloyd.chambers_at_sun.com
Sun Microsystems, Inc