[jboss-remoting-commits] JBoss Remoting SVN: r5014 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Tue Apr 14 06:19:59 EDT 2009
Author: ron.sigal at jboss.com
Date: 2009-04-14 06:19:59 -0400 (Tue, 14 Apr 2009)
New Revision: 5014
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
Log:
JBREM-1116: Eliminated dependence on SecurityUtility.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2009-04-14 10:19:39 UTC (rev 5013)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2009-04-14 10:19:59 UTC (rev 5014)
@@ -163,7 +163,7 @@
Class clazz = null;
try
{
- clazz = (Class) SecurityUtility.forName(protocolHandlerClassName);
+ clazz = (Class) forName(protocolHandlerClassName);
}
catch (ClassNotFoundException e)
{
@@ -363,7 +363,7 @@
if (remoteAddressMB != null)
{
String remoteAddressString = remoteAddressMB.toString();
- InetAddress remoteAddress = SecurityUtility.getAddressByName(remoteAddressString);
+ InetAddress remoteAddress = getAddressByName(remoteAddressString);
invocationRequest.getRequestPayload().put(Remoting.CLIENT_ADDRESS, remoteAddress);
}
else
@@ -1079,7 +1079,7 @@
{
try
{
- params[0] = SecurityUtility.getAddressByName(value);
+ params[0] = getAddressByName(value);
}
catch(UnknownHostException exc)
{
@@ -1144,5 +1144,50 @@
{
return true;
}
-
+
+ static private Object forName(final String className) throws ClassNotFoundException
+ {
+ if (SecurityUtility.skipAccessControl())
+ {
+ return Class.forName(className);
+ }
+
+ try
+ {
+ return AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return Class.forName(className);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (ClassNotFoundException) e.getCause();
+ }
+ }
+
+ static private InetAddress getAddressByName(final String host) throws UnknownHostException
+ {
+ if (SecurityUtility.skipAccessControl())
+ {
+ return InetAddress.getByName(host);
+ }
+
+ try
+ {
+ return (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws IOException
+ {
+ return InetAddress.getByName(host);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
+ }
}
More information about the jboss-remoting-commits
mailing list