[jboss-remoting-commits] JBoss Remoting SVN: r3708 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Thu Mar 20 21:39:44 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-03-20 21:39:44 -0400 (Thu, 20 Mar 2008)
New Revision: 3708

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
Log:
JBREM-934: Put PropertyEditors.mapJavaBeanProperties() and Socket.connect() in AccessController.doPrivileged() calls.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java	2008-03-21 01:38:23 UTC (rev 3707)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java	2008-03-21 01:39:44 UTC (rev 3708)
@@ -19,6 +19,7 @@
 import org.jboss.remoting.marshal.serializable.SerializableMarshaller;
 import org.jboss.util.propertyeditor.PropertyEditors;
 
+import java.beans.IntrospectionException;
 import java.io.EOFException;
 import java.io.IOException;
 import java.io.InputStream;
@@ -28,6 +29,9 @@
 import java.net.Socket;
 import java.net.InetSocketAddress;
 import java.net.SocketException;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -477,9 +481,26 @@
 
    protected void setup() throws Exception
    {
-      Properties props = new Properties();
+      final Properties props = new Properties();
       props.putAll(configuration);
-      PropertyEditors.mapJavaBeanProperties(this, props, false);
+      
+      try
+      {
+         AccessController.doPrivileged( new PrivilegedExceptionAction()
+         {
+            public Object run() throws IntrospectionException
+            {
+               PropertyEditors.mapJavaBeanProperties(this, props, false);
+               return null;
+            }
+         });
+      }
+      catch (PrivilegedActionException e)
+      {
+         log.debug(e.toString(), e);
+         throw e;
+      }
+      
       configureParameters();
 
       if (!InvokerLocator.MULTIHOME.equals(locator.getHost()))
@@ -1099,10 +1120,26 @@
 
    protected Socket createSocket(String address, int port, int timeout) throws IOException
    {
-      Socket s = new Socket();
+      final Socket s = new Socket();
       configureSocket(s);
-      InetSocketAddress inetAddr = new InetSocketAddress(address, port);
-      s.connect(inetAddr);
+      final InetSocketAddress inetAddr = new InetSocketAddress(address, port);
+
+      try
+      {
+         AccessController.doPrivileged( new PrivilegedExceptionAction()
+         {
+            public Object run() throws Exception
+            {
+               s.connect(inetAddr);
+               return null;
+            }
+         });
+      }
+      catch (PrivilegedActionException e)
+      {
+         throw (IOException) e.getCause();
+      }
+
       return s;
    }
    




More information about the jboss-remoting-commits mailing list