[jboss-remoting-commits] JBoss Remoting SVN: r3955 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Fri Apr 11 21:22:15 EDT 2008
Author: ron.sigal at jboss.com
Date: 2008-04-11 21:22:15 -0400 (Fri, 11 Apr 2008)
New Revision: 3955
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
Log:
JBREM-934: (1) Replaced AccessController.doPrivileged() calls with SecurityUtility calls; (2) renamed SystemUtility SecurityUtility.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-04-12 01:21:08 UTC (rev 3954)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-04-12 01:22:15 UTC (rev 3955)
@@ -43,7 +43,7 @@
import org.jboss.remoting.marshal.serializable.SerializableUnMarshaller;
import org.jboss.remoting.serialization.ClassLoaderUtility;
import org.jboss.remoting.transport.web.WebUtil;
-import org.jboss.remoting.util.SystemUtility;
+import org.jboss.remoting.util.SecurityUtility;
import org.jboss.util.Base64;
import org.jboss.util.threadpool.BasicThreadPool;
import org.jboss.util.threadpool.BlockingMode;
@@ -515,23 +515,9 @@
*/
try
{
- Method setChunkedLengthMethod = null;
-
- try
- {
- setChunkedLengthMethod = (Method)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return conn.getClass().getMethod("setChunkedStreamingMode", new Class[]{int.class});
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (Exception) e.getCause();
- }
-
+ Class cl = conn.getClass();
+ Class[] paramTypes = new Class[] {int.class};
+ Method setChunkedLengthMethod = SecurityUtility.getMethod(cl, "setChunkedStreamingMode", paramTypes);
setChunkedLengthMethod.invoke(conn, new Object[]{new Integer(chunkedLength)});
}
catch (NoSuchMethodException e)
@@ -605,37 +591,11 @@
*/
try
{
- Method setTimeoutMethod = null;
- try
- {
- setTimeoutMethod = (Method)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return conn.getClass().getMethod("setConnectTimeout", new Class[]{int.class});
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (Exception) e.getCause();
- }
+ Class cl = conn.getClass();
+ Class[] paramTypes = new Class[] {int.class};
+ Method setTimeoutMethod = SecurityUtility.getMethod(cl, "setConnectTimeout", paramTypes);
setTimeoutMethod.invoke(conn, new Object[]{new Integer(timeout)});
-
- try
- {
- setTimeoutMethod = (Method)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return conn.getClass().getMethod("setReadTimeout", new Class[]{int.class});
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (Exception) e.getCause();
- }
+ setTimeoutMethod = SecurityUtility.getMethod(cl, "setReadTimeout", paramTypes);
setTimeoutMethod.invoke(conn, new Object[]{new Integer(timeout)});
return -1;
}
@@ -775,23 +735,7 @@
}
Constructor proxyConstructor = proxyClass.getConstructor(new Class[] {proxyTypeClass, SocketAddress.class});
Object proxy = proxyConstructor.newInstance(new Object[] {proxyType, proxyAddress});
- Method openConnection = null;
-
- try
- {
- openConnection = (Method)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return URL.class.getMethod("openConnection", new Class[] {proxyClass});
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (Exception) e.getCause();
- }
-
+ Method openConnection = SecurityUtility.getMethod(URL.class, "openConnection", new Class[] {proxyClass});
httpURLConn = (HttpURLConnection)openConnection.invoke(externalURL, new Object[] {proxy});
}
catch (Exception e)
@@ -829,7 +773,7 @@
}
if (username == null || username.length() == 0)
{
- username = SystemUtility.getSystemProperty("http.proxy.username");
+ username = SecurityUtility.getSystemProperty("http.proxy.username");
}
if (metadata != null)
{
@@ -837,7 +781,7 @@
}
if (password == null)
{
- password = SystemUtility.getSystemProperty("http.proxy.password");
+ password = SecurityUtility.getSystemProperty("http.proxy.password");
}
if (username != null && password != null)
@@ -868,7 +812,7 @@
}
if (username == null || username.length() == 0)
{
- username = SystemUtility.getSystemProperty("http.basic.username");
+ username = SecurityUtility.getSystemProperty("http.basic.username");
}
if (metadata != null)
{
@@ -876,7 +820,7 @@
}
if (password == null)
{
- password = SystemUtility.getSystemProperty("http.basic.password");
+ password = SecurityUtility.getSystemProperty("http.basic.password");
}
if (username != null && password != null)
More information about the jboss-remoting-commits
mailing list