mx4j/src/test/test/javax/management MBeanRegistrationTest.java,1.11,1.12

Jeremy Boynes <[email protected]> Wed, 09 Feb 2005 00:37:12 +0000
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Update of /cvsroot/mx4j/mx4j/src/test/test/javax/management
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20030/src/test/test/javax/management

Modified Files:
	MBeanRegistrationTest.java 
Log Message:
Fix for [ 1119006 ] Attempt to create an abstract MBean throws wrong exception
In order to avoid changing the interceptor stack, this fix simply inspects the ReflectionException thrown by instantiateImpl to determine if a NotCompliantMBeanException should be thrown.

Index: MBeanRegistrationTest.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/test/test/javax/management/MBeanRegistrationTest.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** MBeanRegistrationTest.java	13 Nov 2004 16:38:30 -0000	1.11
--- MBeanRegistrationTest.java	9 Feb 2005 00:37:09 -0000	1.12
***************
*** 9,26 ****
  package test.javax.management;
  
! import javax.management.AttributeNotFoundException;
! import javax.management.InstanceAlreadyExistsException;
! import javax.management.InstanceNotFoundException;
! import javax.management.MBeanInfo;
! import javax.management.MBeanRegistration;
! import javax.management.MBeanRegistrationException;
! import javax.management.MBeanServer;
! import javax.management.MBeanServerNotification;
! import javax.management.Notification;
! import javax.management.NotificationListener;
! import javax.management.ObjectInstance;
! import javax.management.ObjectName;
! import javax.management.RuntimeMBeanException;
! import javax.management.RuntimeOperationsException;
  import javax.management.loading.MLet;
  
--- 9,13 ----
  package test.javax.management;
  
! import javax.management.*;
  import javax.management.loading.MLet;
  
***************
*** 479,481 ****
--- 466,497 ----
        assertNull(notification);
     }
+ 
+    public void testAbstractClass() throws Exception
+    {
+       MBeanServer server = newMBeanServer();
+       try {
+          server.createMBean(Foo.class.getName(), null);
+          fail();
+       }
+       catch (NotCompliantMBeanException e)
+       {
+          // ok
+       }
+       catch (Exception e)
+       {
+          e.printStackTrace();
+          fail();
+       }
+    }
+ 
+    public static interface FooMBean
+    {
+       void something();
+    }
+ 
+    public static abstract class Foo implements FooMBean
+    {
+       public void something() {
+       }
+    }
  }



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click