[jboss-remoting-commits] JBoss Remoting SVN: r3860 - remoting2/branches/2.x/src/main/org/jboss/remoting/transporter.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Wed Apr 2 00:31:59 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-04-02 00:31:59 -0400 (Wed, 02 Apr 2008)
New Revision: 3860

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/InternalTransporterServices.java
Log:
JBREM-934: Put MBeanServer.registerMBean() calls in AccessController.doPrivileged() calls.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/InternalTransporterServices.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/InternalTransporterServices.java	2008-04-02 04:31:21 UTC (rev 3859)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/InternalTransporterServices.java	2008-04-02 04:31:59 UTC (rev 3860)
@@ -3,6 +3,10 @@
  */
 package org.jboss.remoting.transporter;
 
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
 import org.jboss.mx.util.ObjectNameFactory;
 import org.jboss.remoting.detection.Detector;
 import org.jboss.remoting.network.NetworkRegistry;
@@ -234,8 +238,22 @@
          m_detectorName = detectorName;
 
          if (registerDetector)
-         {
-            m_mBeanServer.registerMBean(m_detector, m_detectorName);
+         {  
+            try
+            {
+               AccessController.doPrivileged( new PrivilegedExceptionAction()
+               {
+                  public Object run() throws Exception
+                  {
+                     m_mBeanServer.registerMBean(m_detector, m_detectorName);
+                     return null;
+                  }
+               });
+            }
+            catch (PrivilegedActionException e)
+            {
+               throw (Exception) e.getCause();
+            }
          }
       }
 
@@ -294,7 +312,21 @@
 
          if (registerRegistry)
          {
-            m_mBeanServer.registerMBean(m_networkRegistry, m_networkRegistryName);
+            try
+            {
+               AccessController.doPrivileged( new PrivilegedExceptionAction()
+               {
+                  public Object run() throws Exception
+                  {
+                     m_mBeanServer.registerMBean(m_networkRegistry, m_networkRegistryName);
+                     return null;
+                  }
+               });
+            }
+            catch (PrivilegedActionException e)
+            {
+               throw (Exception) e.getCause();
+            }  
          }
       }
 




More information about the jboss-remoting-commits mailing list