--- /home/tromey/gnu/Nightly/classpath/classpath/java/security/AccessController.java 2004-08-26 02:36:36.000000000 -0600
+++ java/security/AccessController.java 2004-04-21 02:18:11.000000000 -0600
@@ -47,6 +47,11 @@
* And provides a getContext() method which gives the access
* control context of the current thread that can be used for checking
* permissions at a later time and/or in another thread.
+ *
+ * XXX - Mostly a stub implementation at the moment. Needs native support
+ * from the VM to function correctly. XXX - Do not forget to think about
+ * how to handle java.lang.reflect.Method.invoke() on the
+ * doPrivileged() methods.
*
* @author Mark Wielaard (mark@klomp.org)
* @since 1.2
@@ -90,15 +95,7 @@
*/
public static Object doPrivileged(PrivilegedAction action)
{
- VMAccessController.pushContext(null);
- try
- {
- return action.run();
- }
- finally
- {
- VMAccessController.popContext();
- }
+ return action.run();
}
/**
@@ -116,17 +113,9 @@
* @return the result of the action.run() method.
*/
public static Object doPrivileged(PrivilegedAction action,
- AccessControlContext context)
+ AccessControlContext context)
{
- VMAccessController.pushContext(context);
- try
- {
- return action.run();
- }
- finally
- {
- VMAccessController.popContext();
- }
+ return action.run();
}
/**
@@ -148,18 +137,14 @@
public static Object doPrivileged(PrivilegedExceptionAction action)
throws PrivilegedActionException
{
- VMAccessController.pushContext(null);
+
try
{
- return action.run();
+ return action.run();
}
catch (Exception e)
{
- throw new PrivilegedActionException(e);
- }
- finally
- {
- VMAccessController.popContext();
+ throw new PrivilegedActionException(e);
}
}
@@ -182,40 +167,31 @@
* is thrown in the run() method.
*/
public static Object doPrivileged(PrivilegedExceptionAction action,
- AccessControlContext context)
+ AccessControlContext context)
throws PrivilegedActionException
{
- VMAccessController.pushContext(context);
+
try
{
- return action.run();
+ return action.run();
}
catch (Exception e)
{
- throw new PrivilegedActionException(e);
- }
- finally
- {
- VMAccessController.popContext();
+ throw new PrivilegedActionException(e);
}
}
/**
* Returns the complete access control context of the current thread.
- * The returned object encompasses all {@link ProtectionDomain} objects
- * for all classes in the current call stack, or the set of protection
- * domains until the last call to {@link
- * #doPrivileged(java.security.PrivilegedAction)}.
- *
- *
Additionally, if a call was made to {@link - * #doPrivileged(java.security.PrivilegedAction,java.security.AccessControlContext)} - * that supplied an {@link AccessControlContext}, then that context - * will be intersected with the calculated one. - * - * @return The context. + *
+ * XXX - Should this include all the protection domains in the call chain
+ * or only the domains till the last doPrivileged() call?
+ *
+ * XXX - needs native support. Currently returns an empty context. */ public static AccessControlContext getContext() { - return VMAccessController.getContext(); + // For now just return an new empty context + return new AccessControlContext(new ProtectionDomain[0]); } }