Author: ron.sigal(a)jboss.com
Date: 2008-05-21 23:41:37 -0400 (Wed, 21 May 2008)
New Revision: 4216
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityUtility.java
Log:
JBREM-978: Added two classloader retrieval methods.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityUtility.java
===================================================================
---
remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityUtility.java 2008-05-22
03:40:07 UTC (rev 4215)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityUtility.java 2008-05-22
03:41:37 UTC (rev 4216)
@@ -64,10 +64,9 @@
import javax.servlet.http.HttpServletResponse;
import org.jboss.remoting.Remoting;
+import org.jboss.remoting.loading.RemotingClassLoader;
import org.jboss.remoting.security.ServerSocketFactoryMBean;
-import org.jboss.remoting.transport.rmi.RMIServerInvoker;
import org.jboss.remoting.transport.rmi.RMIServerInvokerInf;
-import org.jboss.remoting.transport.rmi.RemotingRMIClientSocketFactory;
import org.jboss.remoting.transport.servlet.ServletServerInvokerMBean;
import org.jboss.serial.io.JBossObjectInputStream;
import org.jboss.serial.io.JBossObjectOutputStream;
@@ -129,7 +128,6 @@
return skipAccessControl;
}
-
///////////////////////////////////////////////////////////////////////////////////////
// FilePermission methods
///////////////////////////////////////////////////////////////////////////////////////
@@ -423,7 +421,7 @@
catch (PrivilegedActionException e)
{
throw (Exception) e.getCause();
- }
+ }
}
@@ -436,7 +434,7 @@
try
{
c = Class.forName("java.lang.management.ManagementFactory");
- }
+ }
catch (Exception e)
{
System.out.println("Unable to access
java.lang.management.ManagementFactory: must be using jdk 1.4");
@@ -458,7 +456,7 @@
try
{
c = Class.forName("java.lang.management.ManagementFactory");
- }
+ }
catch (Exception e)
{
System.out.println("Unable to access
java.lang.management.ManagementFactory: must be using jdk 1.4");
@@ -479,7 +477,7 @@
throw (IllegalAccessException) cause;
else
throw (InvocationTargetException) cause;
- }
+ }
}
@@ -677,6 +675,23 @@
// RuntimePermission methods
///////////////////////////////////////////////////////////////////////////////////////
+ static public RemotingClassLoader createRemotingClassLoader(final ClassLoader
remotingClassLoader, final ClassLoader userClassLoader)
+ {
+ if (skipAccessControl)
+ {
+ return new RemotingClassLoader(remotingClassLoader, userClassLoader);
+ }
+
+ return (RemotingClassLoader)AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return new RemotingClassLoader(remotingClassLoader, userClassLoader);
+ }
+ });
+ }
+
+
static public Object forName(final String className) throws ClassNotFoundException
{
if (skipAccessControl)
@@ -718,6 +733,23 @@
}
+ static public ClassLoader getContextClassLoader(final Thread thread)
+ {
+ if (skipAccessControl)
+ {
+ return thread.getContextClassLoader();
+ }
+
+ return (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return thread.getContextClassLoader();
+ }
+ });
+ }
+
+
static public ClassLoader getSystemClassLoader()
{
if (skipAccessControl)
@@ -848,7 +880,6 @@
}
}
-
///////////////////////////////////////////////////////////////////////////////////////
// SocketPermission methods
///////////////////////////////////////////////////////////////////////////////////////
Show replies by date