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

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Fri Apr 11 20:58:16 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-04-11 20:58:16 -0400 (Fri, 11 Apr 2008)
New Revision: 3935

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() calls with SecurityUtility calls..

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java	2008-04-12 00:56:37 UTC (rev 3934)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java	2008-04-12 00:58:16 UTC (rev 3935)
@@ -34,7 +34,7 @@
 import org.jboss.remoting.security.SSLSocketBuilder;
 import org.jboss.remoting.security.SSLSocketBuilderMBean;
 import org.jboss.remoting.security.SSLSocketFactoryService;
-import org.jboss.remoting.util.SystemUtility;
+import org.jboss.remoting.util.SecurityUtility;
 
 import javax.management.MBeanServer;
 import javax.management.MBeanServerInvocationHandler;
@@ -291,40 +291,12 @@
             final ObjectName serverSocketFactoryObjName = new ObjectName(serverSocketFactoryString);
             if (server != null)
             {
-               boolean isCorrectType = false;
-               try
-               {
-                  isCorrectType = ((Boolean)AccessController.doPrivileged( new PrivilegedExceptionAction()
-                  {
-                     public Object run() throws Exception
-                     {
-                        String className = SSLServerSocketFactoryServiceMBean.class.getName();
-                        return new Boolean(server.isInstanceOf(serverSocketFactoryObjName, className));
-                     }
-                  })).booleanValue();
-               }
-               catch (PrivilegedActionException e)
-               {
-                  throw (Exception) e.getCause();
-               }
-
+               String className = SSLServerSocketFactoryServiceMBean.class.getName();
+               boolean isCorrectType = SecurityUtility.isInstanceOf(server, serverSocketFactoryObjName, className);
                if (isCorrectType)
                {
-                  SSLSocketBuilderMBean sslSocketBuilder = null;             
-                  try
-                  {
-                     sslSocketBuilder = (SSLSocketBuilderMBean)AccessController.doPrivileged( new PrivilegedExceptionAction()
-                     {
-                        public Object run() throws Exception
-                        {
-                           return server.getAttribute(serverSocketFactoryObjName, "SSLSocketBuilder");
-                        }
-                     });
-                  }
-                  catch (PrivilegedActionException e)
-                  {
-                     throw (Exception) e.getCause();
-                  }
+                  Object o = SecurityUtility.getMBeanAttribute(server, serverSocketFactoryObjName, "SSLSocketBuilder");             
+                  SSLSocketBuilderMBean sslSocketBuilder = (SSLSocketBuilderMBean) o;
                   
                   if (sslSocketBuilder != null)
                   {
@@ -346,8 +318,9 @@
                }
             }
          }
-         catch (MalformedObjectNameException ignored)
+         catch (Exception ignored)
          {
+            log.debug("error", ignored);
          }
       }
 
@@ -448,32 +421,15 @@
          Map storeConfig = new HashMap();
          storeConfig.putAll(owner.getConfiguration());
 
-         String newFilePath = "data";
-
          String filePath = (String) storeConfig.get(CallbackStore.FILE_PATH_KEY);
          if(filePath == null)
          {
-            try
-            {
-               newFilePath = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
-               {
-                  public Object run() throws Exception
-                  {
-                     return System.getProperty("jboss.server.data.dir", "data");
-                  }
-               });
-            }
-            catch (PrivilegedActionException e)
-            {
-               log.debug("error", e.getCause());
-            }
+            filePath = SecurityUtility.getSystemProperty("jboss.server.data.dir", "data");
          }
-         
-         String separator = SystemUtility.getSystemProperty("file.separator");
-         newFilePath = newFilePath + separator + "remoting" + separator + sessionId;
 
+         String separator = SecurityUtility.getSystemProperty("file.separator");
+         String newFilePath = filePath + separator + "remoting" + separator + sessionId;
          storeConfig.put(CallbackStore.FILE_PATH_KEY, newFilePath);
-
          callbackStore.setConfig(storeConfig);
       }
 




More information about the jboss-remoting-commits mailing list