Author: ron.sigal(a)jboss.com
Date: 2008-04-02 01:28:26 -0400 (Wed, 02 Apr 2008)
New Revision: 3865
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/multicast/MulticastDetectorTestCase.java
Log:
JBREM-934: Put MBeanServerFactory.createMBeanServer() call in
AccessController.doPrivileged() call.
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/multicast/MulticastDetectorTestCase.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/multicast/MulticastDetectorTestCase.java 2008-04-02
05:27:44 UTC (rev 3864)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/multicast/MulticastDetectorTestCase.java 2008-04-02
05:28:26 UTC (rev 3865)
@@ -1,8 +1,11 @@
package org.jboss.test.remoting.detection.multicast;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
import junit.framework.TestCase;
import org.jboss.remoting.detection.multicast.MulticastDetector;
-
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.ObjectName;
@@ -20,7 +23,22 @@
protected void setUp() throws Exception
{
super.setUp();
- server = MBeanServerFactory.createMBeanServer();
+
+ try
+ {
+ server = (MBeanServer) AccessController.doPrivileged( new
PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return MBeanServerFactory.createMBeanServer();
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (Exception) e.getCause();
+ }
+
objectName = new ObjectName("remoting:type=MulticastDetector");
}
Show replies by date