/[classpath]/classpath/java/security/AccessController.java
ViewVC logotype

Diff of /classpath/java/security/AccessController.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by mkoch, Thu Jun 3 09:16:58 2004 UTC revision 1.9 by rsdio, Sat Aug 21 22:51:19 2004 UTC
# Line 47  package java.security; Line 47  package java.security;
47   * And provides a <code>getContext()</code> method which gives the access   * And provides a <code>getContext()</code> method which gives the access
48   * control context of the current thread that can be used for checking   * control context of the current thread that can be used for checking
49   * permissions at a later time and/or in another thread.   * permissions at a later time and/or in another thread.
  * <p>  
  * 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 <code>java.lang.reflect.Method.invoke()</code> on the  
  * <code>doPrivileged()</code> methods.  
50   *   *
51   * @author Mark Wielaard (mark@klomp.org)   * @author Mark Wielaard (mark@klomp.org)
52   * @since 1.2   * @since 1.2
# Line 95  public final class AccessController Line 90  public final class AccessController
90     */     */
91    public static Object doPrivileged(PrivilegedAction action)    public static Object doPrivileged(PrivilegedAction action)
92    {    {
93      return action.run();      VMAccessController.pushContext(null);
94        try
95          {
96            return action.run();
97          }
98        finally
99          {
100            VMAccessController.popContext();
101          }
102    }    }
103    
104    /**    /**
# Line 113  public final class AccessController Line 116  public final class AccessController
116     * @return the result of the <code>action.run()</code> method.     * @return the result of the <code>action.run()</code> method.
117     */     */
118    public static Object doPrivileged(PrivilegedAction action,    public static Object doPrivileged(PrivilegedAction action,
119                                      AccessControlContext context)                                      AccessControlContext context)
120    {    {
121      VMAccessController.pushContext (context, action.getClass());      VMAccessController.pushContext(context);
122      try      try
123        {        {
124          return action.run();          return action.run();
125        }        }
126      finally      finally
127        {        {
128          VMAccessController.popContext (action.getClass());          VMAccessController.popContext();
129        }        }
130    }    }
131    
# Line 145  public final class AccessController Line 148  public final class AccessController
148    public static Object doPrivileged(PrivilegedExceptionAction action)    public static Object doPrivileged(PrivilegedExceptionAction action)
149      throws PrivilegedActionException      throws PrivilegedActionException
150    {    {
151        VMAccessController.pushContext(null);
152      try      try
153        {        {
154          return action.run();          return action.run();
155        }        }
156      catch (Exception e)      catch (Exception e)
157        {        {
158          throw new PrivilegedActionException(e);          throw new PrivilegedActionException(e);
159          }
160        finally
161          {
162            VMAccessController.popContext();
163        }        }
164    }    }
165    
# Line 175  public final class AccessController Line 182  public final class AccessController
182     * is thrown in the <code>run()</code> method.     * is thrown in the <code>run()</code> method.
183     */     */
184    public static Object doPrivileged(PrivilegedExceptionAction action,    public static Object doPrivileged(PrivilegedExceptionAction action,
185                                      AccessControlContext context)                                      AccessControlContext context)
186      throws PrivilegedActionException      throws PrivilegedActionException
187    {    {
188      VMAccessController.pushContext (context, action.getClass());      VMAccessController.pushContext(context);
   
189      try      try
190        {        {
191          return action.run();          return action.run();
192        }        }
193      catch (Exception e)      catch (Exception e)
194        {        {
195          throw new PrivilegedActionException(e);          throw new PrivilegedActionException(e);
196        }        }
197      finally      finally
198        {        {
199          VMAccessController.popContext (action.getClass());          VMAccessController.popContext();
200        }        }
201    }    }
202    

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26