Hi,
I think I found a (very) small bug in the MulticastDetector implementation.
If you don't call start and then stop or if you call stop twice, you will get a 
NullPointerException (see JUnit test below). This is no major issue (after all 
you can just call the methods correctly), but I think frameworks shouldn't 
produce NullPointerExceptions when used incorrectly.

public class MulticastDetectorTest extends TestCase {
  | 
  |     private MBeanServer server;
  | 
  |     private ObjectName objectName;
  | 
  |     protected void setUp() throws Exception {
  |             super.setUp();
  |             server = ManagementFactory.getPlatformMBeanServer();
  |             objectName = new ObjectName("remoting:type=MulticastDetector");
  |     }
  | 
  |     protected void tearDown() throws Exception {
  |             super.tearDown();
  |     }
  | 
  |     public void testStopWithoutStart() throws Exception {
  |             MulticastDetector detector = new MulticastDetector();
  |             server.registerMBean(detector, objectName);
  |             // don't call detector.start();
  |             Thread.sleep(1000);
  | 
  |             server.unregisterMBean(objectName);
  |             detector.stop();
  |     }
  |     
  |     public void testCallingStopTwice() throws Exception {
  |             MulticastDetector detector = new MulticastDetector();
  |             server.registerMBean(detector, objectName);
  |             detector.start();
  |             Thread.sleep(1000);
  | 
  |             server.unregisterMBean(objectName);
  |             detector.stop();
  |             detector.stop();
  |     }
  | }
  | 

Chris

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3929599#3929599

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3929599


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to