src/share/classes/java/security/AccessController.java

Print this page

        

*** 47,57 **** * respect to the saved context. </ul> * * <p> The {@link #checkPermission(Permission) checkPermission} method * determines whether the access request indicated by a specified * permission should be granted or denied. A sample call appears ! * below. In this example, <code>checkPermission</code> will determine * whether or not to grant "read" access to the file named "testFile" in * the "/temp" directory. * * <pre> * --- 47,57 ---- * respect to the saved context. </ul> * * <p> The {@link #checkPermission(Permission) checkPermission} method * determines whether the access request indicated by a specified * permission should be granted or denied. A sample call appears ! * below. In this example, {@code checkPermission} will determine * whether or not to grant "read" access to the file named "testFile" in * the "/temp" directory. * * <pre> *
*** 59,78 **** * AccessController.checkPermission(perm); * * </pre> * * <p> If a requested access is allowed, ! * <code>checkPermission</code> returns quietly. If denied, an * AccessControlException is * thrown. AccessControlException can also be thrown if the requested * permission is of an incorrect type or contains an invalid value. * Such information is given whenever possible. * * Suppose the current thread traversed m callers, in the order of caller 1 * to caller 2 to caller m. Then caller m invoked the ! * <code>checkPermission</code> method. ! * The <code>checkPermission </code>method determines whether access * is granted or denied based on the following algorithm: * * <pre> {@code * for (int i = m; i > 0; i--) { * --- 59,78 ---- * AccessController.checkPermission(perm); * * </pre> * * <p> If a requested access is allowed, ! * {@code checkPermission} returns quietly. If denied, an * AccessControlException is * thrown. AccessControlException can also be thrown if the requested * permission is of an incorrect type or contains an invalid value. * Such information is given whenever possible. * * Suppose the current thread traversed m callers, in the order of caller 1 * to caller 2 to caller m. Then caller m invoked the ! * {@code checkPermission} method. ! * The {@code checkPermission} method determines whether access * is granted or denied based on the following algorithm: * * <pre> {@code * for (int i = m; i > 0; i--) { *
*** 100,123 **** * inheritedContext.checkPermission(permission); * }</pre> * * <p> A caller can be marked as being "privileged" * (see {@link #doPrivileged(PrivilegedAction) doPrivileged} and below). ! * When making access control decisions, the <code>checkPermission</code> * method stops checking if it reaches a caller that ! * was marked as "privileged" via a <code>doPrivileged</code> * call without a context argument (see below for information about a * context argument). If that caller's domain has the * specified permission and at least one limiting permission argument (if any) * implies the requested permission, no further checking is done and ! * <code>checkPermission</code> * returns quietly, indicating that the requested access is allowed. * If that domain does not have the specified permission, an exception * is thrown, as usual. If the caller's domain had the specified permission * but it was not implied by any limiting permission arguments given in the call ! * to <code>doPrivileged</code> then the permission checking continues ! * until there are no more callers or another <code>doPrivileged</code> * call matches the requested permission and returns normally. * * <p> The normal use of the "privileged" feature is as follows. If you * don't need to return a value from within the "privileged" block, do * the following: --- 100,123 ---- * inheritedContext.checkPermission(permission); * }</pre> * * <p> A caller can be marked as being "privileged" * (see {@link #doPrivileged(PrivilegedAction) doPrivileged} and below). ! * When making access control decisions, the {@code checkPermission} * method stops checking if it reaches a caller that ! * was marked as "privileged" via a {@code doPrivileged} * call without a context argument (see below for information about a * context argument). If that caller's domain has the * specified permission and at least one limiting permission argument (if any) * implies the requested permission, no further checking is done and ! * {@code checkPermission} * returns quietly, indicating that the requested access is allowed. * If that domain does not have the specified permission, an exception * is thrown, as usual. If the caller's domain had the specified permission * but it was not implied by any limiting permission arguments given in the call ! * to {@code doPrivileged} then the permission checking continues ! * until there are no more callers or another {@code doPrivileged} * call matches the requested permission and returns normally. * * <p> The normal use of the "privileged" feature is as follows. If you * don't need to return a value from within the "privileged" block, do * the following:
*** 135,155 **** * ...normal code here... * }}</pre> * * <p> * PrivilegedAction is an interface with a single method, named ! * <code>run</code>. * The above example shows creation of an implementation * of that interface; a concrete implementation of the ! * <code>run</code> method is supplied. ! * When the call to <code>doPrivileged</code> is made, an * instance of the PrivilegedAction implementation is passed ! * to it. The <code>doPrivileged</code> method calls the ! * <code>run</code> method from the PrivilegedAction * implementation after enabling privileges, and returns the ! * <code>run</code> method's return value as the ! * <code>doPrivileged</code> return value (which is * ignored in this example). * * <p> If you need to return a value, you can do something like the following: * * <pre> {@code --- 135,155 ---- * ...normal code here... * }}</pre> * * <p> * PrivilegedAction is an interface with a single method, named ! * {@code run}. * The above example shows creation of an implementation * of that interface; a concrete implementation of the ! * {@code run} method is supplied. ! * When the call to {@code doPrivileged} is made, an * instance of the PrivilegedAction implementation is passed ! * to it. The {@code doPrivileged} method calls the ! * {@code run} method from the PrivilegedAction * implementation after enabling privileges, and returns the ! * {@code run} method's return value as the ! * {@code doPrivileged} return value (which is * ignored in this example). * * <p> If you need to return a value, you can do something like the following: * * <pre> {@code
*** 162,176 **** * } * }); * ...normal code here... * }}</pre> * ! * <p>If the action performed in your <code>run</code> method could ! * throw a "checked" exception (those listed in the <code>throws</code> clause * of a method), then you need to use the ! * <code>PrivilegedExceptionAction</code> interface instead of the ! * <code>PrivilegedAction</code> interface: * * <pre> {@code * somemethod() throws FileNotFoundException { * ...normal code here... * try { --- 162,176 ---- * } * }); * ...normal code here... * }}</pre> * ! * <p>If the action performed in your {@code run} method could ! * throw a "checked" exception (those listed in the {@code throws} clause * of a method), then you need to use the ! * {@code PrivilegedExceptionAction} interface instead of the ! * {@code PrivilegedAction} interface: * * <pre> {@code * somemethod() throws FileNotFoundException { * ...normal code here... * try {
*** 189,210 **** * ...normal code here... * }}</pre> * * <p> Be *very* careful in your use of the "privileged" construct, and * always remember to make the privileged code section as small as possible. ! * You can pass <code>Permission</code> arguments to further limit the * scope of the "privilege" (see below). * * ! * <p> Note that <code>checkPermission</code> always performs security checks * within the context of the currently executing thread. * Sometimes a security check that should be made within a given context * will actually need to be done from within a * <i>different</i> context (for example, from within a worker thread). * The {@link #getContext() getContext} method and * AccessControlContext class are provided ! * for this situation. The <code>getContext</code> method takes a "snapshot" * of the current calling context, and places * it in an AccessControlContext object, which it returns. A sample call is * the following: * * <pre> --- 189,210 ---- * ...normal code here... * }}</pre> * * <p> Be *very* careful in your use of the "privileged" construct, and * always remember to make the privileged code section as small as possible. ! * You can pass {@code Permission} arguments to further limit the * scope of the "privilege" (see below). * * ! * <p> Note that {@code checkPermission} always performs security checks * within the context of the currently executing thread. * Sometimes a security check that should be made within a given context * will actually need to be done from within a * <i>different</i> context (for example, from within a worker thread). * The {@link #getContext() getContext} method and * AccessControlContext class are provided ! * for this situation. The {@code getContext} method takes a "snapshot" * of the current calling context, and places * it in an AccessControlContext object, which it returns. A sample call is * the following: * * <pre>
*** 212,222 **** * AccessControlContext acc = AccessController.getContext() * * </pre> * * <p> ! * AccessControlContext itself has a <code>checkPermission</code> method * that makes access decisions based on the context <i>it</i> encapsulates, * rather than that of the current execution thread. * Code within a different context can thus call that method on the * previously-saved AccessControlContext object. A sample call is the * following: --- 212,222 ---- * AccessControlContext acc = AccessController.getContext() * * </pre> * * <p> ! * AccessControlContext itself has a {@code checkPermission} method * that makes access decisions based on the context <i>it</i> encapsulates, * rather than that of the current execution thread. * Code within a different context can thus call that method on the * previously-saved AccessControlContext object. A sample call is the * following:
*** 228,238 **** * </pre> * * <p> There are also times where you don't know a priori which permissions * to check the context against. In these cases you can use the * doPrivileged method that takes a context. You can also limit the scope ! * of the privileged code by passing additional <code>Permission</code> * parameters. * * <pre> {@code * somemethod() { * AccessController.doPrivileged(new PrivilegedAction<Object>() { --- 228,238 ---- * </pre> * * <p> There are also times where you don't know a priori which permissions * to check the context against. In these cases you can use the * doPrivileged method that takes a context. You can also limit the scope ! * of the privileged code by passing additional {@code Permission} * parameters. * * <pre> {@code * somemethod() { * AccessController.doPrivileged(new PrivilegedAction<Object>() {
*** 246,261 **** * // caller of doPrivileged. * } * }, acc, new FilePermission("/temp/*", read)); * ...normal code here... * }}</pre> ! * <p> Passing a limiting <code>Permission</code> argument of an instance of ! * <code>AllPermission</code> is equivalent to calling the equivalent ! * <code>doPrivileged</code> method without limiting <code>Permission</code> ! * arguments. Passing a zero length array of <code>Permission</code> disables * the code privileges so that checking always continues beyond the caller of ! * that <code>doPrivileged</code> method. * * @see AccessControlContext * * @author Li Gong * @author Roland Schemers --- 246,261 ---- * // caller of doPrivileged. * } * }, acc, new FilePermission("/temp/*", read)); * ...normal code here... * }}</pre> ! * <p> Passing a limiting {@code Permission} argument of an instance of ! * {@code AllPermission} is equivalent to calling the equivalent ! * {@code doPrivileged} method without limiting {@code Permission} ! * arguments. Passing a zero length array of {@code Permission} disables * the code privileges so that checking always continues beyond the caller of ! * that {@code doPrivileged} method. * * @see AccessControlContext * * @author Li Gong * @author Roland Schemers
*** 267,291 **** * Don't allow anyone to instantiate an AccessController */ private AccessController() { } /** ! * Performs the specified <code>PrivilegedAction</code> with privileges * enabled. The action is performed with <i>all</i> of the permissions * possessed by the caller's protection domain. * ! * <p> If the action's <code>run</code> method throws an (unchecked) * exception, it will propagate through this method. * * <p> Note that any DomainCombiner associated with the current * AccessControlContext will be ignored while the action is performed. * * @param action the action to be performed. * ! * @return the value returned by the action's <code>run</code> method. * ! * @exception NullPointerException if the action is <code>null</code> * * @see #doPrivileged(PrivilegedAction,AccessControlContext) * @see #doPrivileged(PrivilegedExceptionAction) * @see #doPrivilegedWithCombiner(PrivilegedAction) * @see java.security.DomainCombiner --- 267,291 ---- * Don't allow anyone to instantiate an AccessController */ private AccessController() { } /** ! * Performs the specified {@code PrivilegedAction} with privileges * enabled. The action is performed with <i>all</i> of the permissions * possessed by the caller's protection domain. * ! * <p> If the action's {@code run} method throws an (unchecked) * exception, it will propagate through this method. * * <p> Note that any DomainCombiner associated with the current * AccessControlContext will be ignored while the action is performed. * * @param action the action to be performed. * ! * @return the value returned by the action's {@code run} method. * ! * @exception NullPointerException if the action is {@code null} * * @see #doPrivileged(PrivilegedAction,AccessControlContext) * @see #doPrivileged(PrivilegedExceptionAction) * @see #doPrivilegedWithCombiner(PrivilegedAction) * @see java.security.DomainCombiner
*** 293,317 **** @CallerSensitive public static native <T> T doPrivileged(PrivilegedAction<T> action); /** ! * Performs the specified <code>PrivilegedAction</code> with privileges * enabled. The action is performed with <i>all</i> of the permissions * possessed by the caller's protection domain. * ! * <p> If the action's <code>run</code> method throws an (unchecked) * exception, it will propagate through this method. * * <p> This method preserves the current AccessControlContext's * DomainCombiner (which may be null) while the action is performed. * * @param action the action to be performed. * ! * @return the value returned by the action's <code>run</code> method. * ! * @exception NullPointerException if the action is <code>null</code> * * @see #doPrivileged(PrivilegedAction) * @see java.security.DomainCombiner * * @since 1.6 --- 293,317 ---- @CallerSensitive public static native <T> T doPrivileged(PrivilegedAction<T> action); /** ! * Performs the specified {@code PrivilegedAction} with privileges * enabled. The action is performed with <i>all</i> of the permissions * possessed by the caller's protection domain. * ! * <p> If the action's {@code run} method throws an (unchecked) * exception, it will propagate through this method. * * <p> This method preserves the current AccessControlContext's * DomainCombiner (which may be null) while the action is performed. * * @param action the action to be performed. * ! * @return the value returned by the action's {@code run} method. * ! * @exception NullPointerException if the action is {@code null} * * @see #doPrivileged(PrivilegedAction) * @see java.security.DomainCombiner * * @since 1.6
*** 362,399 **** public static native <T> T doPrivileged(PrivilegedAction<T> action, AccessControlContext context); /** ! * Performs the specified <code>PrivilegedAction</code> with privileges * enabled and restricted by the specified ! * <code>AccessControlContext</code> and with a privilege scope limited ! * by specified <code>Permission</code> arguments. * * The action is performed with the intersection of the permissions * possessed by the caller's protection domain, and those possessed * by the domains represented by the specified ! * <code>AccessControlContext</code>. * <p> ! * If the action's <code>run</code> method throws an (unchecked) exception, * it will propagate through this method. * * @param action the action to be performed. * @param context an <i>access control context</i> * representing the restriction to be applied to the * caller's domain's privileges before performing * the specified action. If the context is ! * <code>null</code>, * then no additional restriction is applied. ! * @param perms the <code>Permission</code> arguments which limit the * scope of the caller's privileges. The number of arguments * is variable. * ! * @return the value returned by the action's <code>run</code> method. * * @throws NullPointerException if action or perms or any element of ! * perms is <code>null</code> * * @see #doPrivileged(PrivilegedAction) * @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext) * * @since 1.8 --- 362,399 ---- public static native <T> T doPrivileged(PrivilegedAction<T> action, AccessControlContext context); /** ! * Performs the specified {@code PrivilegedAction} with privileges * enabled and restricted by the specified ! * {@code AccessControlContext} and with a privilege scope limited ! * by specified {@code Permission} arguments. * * The action is performed with the intersection of the permissions * possessed by the caller's protection domain, and those possessed * by the domains represented by the specified ! * {@code AccessControlContext}. * <p> ! * If the action's {@code run} method throws an (unchecked) exception, * it will propagate through this method. * * @param action the action to be performed. * @param context an <i>access control context</i> * representing the restriction to be applied to the * caller's domain's privileges before performing * the specified action. If the context is ! * {@code null}, * then no additional restriction is applied. ! * @param perms the {@code Permission} arguments which limit the * scope of the caller's privileges. The number of arguments * is variable. * ! * @return the value returned by the action's {@code run} method. * * @throws NullPointerException if action or perms or any element of ! * perms is {@code null} * * @see #doPrivileged(PrivilegedAction) * @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext) * * @since 1.8
*** 411,451 **** caller, parent, context, perms)); } /** ! * Performs the specified <code>PrivilegedAction</code> with privileges * enabled and restricted by the specified ! * <code>AccessControlContext</code> and with a privilege scope limited ! * by specified <code>Permission</code> arguments. * * The action is performed with the intersection of the permissions * possessed by the caller's protection domain, and those possessed * by the domains represented by the specified ! * <code>AccessControlContext</code>. * <p> ! * If the action's <code>run</code> method throws an (unchecked) exception, * it will propagate through this method. * * <p> This method preserves the current AccessControlContext's * DomainCombiner (which may be null) while the action is performed. * * @param action the action to be performed. * @param context an <i>access control context</i> * representing the restriction to be applied to the * caller's domain's privileges before performing * the specified action. If the context is ! * <code>null</code>, * then no additional restriction is applied. ! * @param perms the <code>Permission</code> arguments which limit the * scope of the caller's privileges. The number of arguments * is variable. * ! * @return the value returned by the action's <code>run</code> method. * * @throws NullPointerException if action or perms or any element of ! * perms is <code>null</code> * * @see #doPrivileged(PrivilegedAction) * @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext) * @see java.security.DomainCombiner * --- 411,451 ---- caller, parent, context, perms)); } /** ! * Performs the specified {@code PrivilegedAction} with privileges * enabled and restricted by the specified ! * {@code AccessControlContext} and with a privilege scope limited ! * by specified {@code Permission} arguments. * * The action is performed with the intersection of the permissions * possessed by the caller's protection domain, and those possessed * by the domains represented by the specified ! * {@code AccessControlContext}. * <p> ! * If the action's {@code run} method throws an (unchecked) exception, * it will propagate through this method. * * <p> This method preserves the current AccessControlContext's * DomainCombiner (which may be null) while the action is performed. * * @param action the action to be performed. * @param context an <i>access control context</i> * representing the restriction to be applied to the * caller's domain's privileges before performing * the specified action. If the context is ! * {@code null}, * then no additional restriction is applied. ! * @param perms the {@code Permission} arguments which limit the * scope of the caller's privileges. The number of arguments * is variable. * ! * @return the value returned by the action's {@code run} method. * * @throws NullPointerException if action or perms or any element of ! * perms is {@code null} * * @see #doPrivileged(PrivilegedAction) * @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext) * @see java.security.DomainCombiner *
*** 467,493 **** return AccessController.doPrivileged(action, createWrapper(dc, caller, parent, context, perms)); } /** ! * Performs the specified <code>PrivilegedExceptionAction</code> with * privileges enabled. The action is performed with <i>all</i> of the * permissions possessed by the caller's protection domain. * ! * <p> If the action's <code>run</code> method throws an <i>unchecked</i> * exception, it will propagate through this method. * * <p> Note that any DomainCombiner associated with the current * AccessControlContext will be ignored while the action is performed. * * @param action the action to be performed * ! * @return the value returned by the action's <code>run</code> method * * @exception PrivilegedActionException if the specified action's ! * <code>run</code> method threw a <i>checked</i> exception ! * @exception NullPointerException if the action is <code>null</code> * * @see #doPrivileged(PrivilegedAction) * @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext) * @see #doPrivilegedWithCombiner(PrivilegedExceptionAction) * @see java.security.DomainCombiner --- 467,493 ---- return AccessController.doPrivileged(action, createWrapper(dc, caller, parent, context, perms)); } /** ! * Performs the specified {@code PrivilegedExceptionAction} with * privileges enabled. The action is performed with <i>all</i> of the * permissions possessed by the caller's protection domain. * ! * <p> If the action's {@code run} method throws an <i>unchecked</i> * exception, it will propagate through this method. * * <p> Note that any DomainCombiner associated with the current * AccessControlContext will be ignored while the action is performed. * * @param action the action to be performed * ! * @return the value returned by the action's {@code run} method * * @exception PrivilegedActionException if the specified action's ! * {@code run} method threw a <i>checked</i> exception ! * @exception NullPointerException if the action is {@code null} * * @see #doPrivileged(PrivilegedAction) * @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext) * @see #doPrivilegedWithCombiner(PrivilegedExceptionAction) * @see java.security.DomainCombiner
*** 497,523 **** doPrivileged(PrivilegedExceptionAction<T> action) throws PrivilegedActionException; /** ! * Performs the specified <code>PrivilegedExceptionAction</code> with * privileges enabled. The action is performed with <i>all</i> of the * permissions possessed by the caller's protection domain. * ! * <p> If the action's <code>run</code> method throws an <i>unchecked</i> * exception, it will propagate through this method. * * <p> This method preserves the current AccessControlContext's * DomainCombiner (which may be null) while the action is performed. * * @param action the action to be performed. * ! * @return the value returned by the action's <code>run</code> method * * @exception PrivilegedActionException if the specified action's ! * <code>run</code> method threw a <i>checked</i> exception ! * @exception NullPointerException if the action is <code>null</code> * * @see #doPrivileged(PrivilegedAction) * @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext) * @see java.security.DomainCombiner * --- 497,523 ---- doPrivileged(PrivilegedExceptionAction<T> action) throws PrivilegedActionException; /** ! * Performs the specified {@code PrivilegedExceptionAction} with * privileges enabled. The action is performed with <i>all</i> of the * permissions possessed by the caller's protection domain. * ! * <p> If the action's {@code run} method throws an <i>unchecked</i> * exception, it will propagate through this method. * * <p> This method preserves the current AccessControlContext's * DomainCombiner (which may be null) while the action is performed. * * @param action the action to be performed. * ! * @return the value returned by the action's {@code run} method * * @exception PrivilegedActionException if the specified action's ! * {@code run} method threw a <i>checked</i> exception ! * @exception NullPointerException if the action is {@code null} * * @see #doPrivileged(PrivilegedAction) * @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext) * @see java.security.DomainCombiner *
*** 607,646 **** AccessControlContext context) throws PrivilegedActionException; /** ! * Performs the specified <code>PrivilegedExceptionAction</code> with * privileges enabled and restricted by the specified ! * <code>AccessControlContext</code> and with a privilege scope limited by ! * specified <code>Permission</code> arguments. * * The action is performed with the intersection of the permissions * possessed by the caller's protection domain, and those possessed * by the domains represented by the specified ! * <code>AccessControlContext</code>. * <p> ! * If the action's <code>run</code> method throws an (unchecked) exception, * it will propagate through this method. * * @param action the action to be performed. * @param context an <i>access control context</i> * representing the restriction to be applied to the * caller's domain's privileges before performing * the specified action. If the context is ! * <code>null</code>, * then no additional restriction is applied. ! * @param perms the <code>Permission</code> arguments which limit the * scope of the caller's privileges. The number of arguments * is variable. * ! * @return the value returned by the action's <code>run</code> method. * * @throws PrivilegedActionException if the specified action's ! * <code>run</code> method threw a <i>checked</i> exception * @throws NullPointerException if action or perms or any element of ! * perms is <code>null</code> * * @see #doPrivileged(PrivilegedAction) * @see #doPrivileged(PrivilegedAction,AccessControlContext) * * @since 1.8 --- 607,646 ---- AccessControlContext context) throws PrivilegedActionException; /** ! * Performs the specified {@code PrivilegedExceptionAction} with * privileges enabled and restricted by the specified ! * {@code AccessControlContext} and with a privilege scope limited by ! * specified {@code Permission} arguments. * * The action is performed with the intersection of the permissions * possessed by the caller's protection domain, and those possessed * by the domains represented by the specified ! * {@code AccessControlContext}. * <p> ! * If the action's {@code run} method throws an (unchecked) exception, * it will propagate through this method. * * @param action the action to be performed. * @param context an <i>access control context</i> * representing the restriction to be applied to the * caller's domain's privileges before performing * the specified action. If the context is ! * {@code null}, * then no additional restriction is applied. ! * @param perms the {@code Permission} arguments which limit the * scope of the caller's privileges. The number of arguments * is variable. * ! * @return the value returned by the action's {@code run} method. * * @throws PrivilegedActionException if the specified action's ! * {@code run} method threw a <i>checked</i> exception * @throws NullPointerException if action or perms or any element of ! * perms is {@code null} * * @see #doPrivileged(PrivilegedAction) * @see #doPrivileged(PrivilegedAction,AccessControlContext) * * @since 1.8
*** 658,700 **** return AccessController.doPrivileged(action, createWrapper(null, caller, parent, context, perms)); } /** ! * Performs the specified <code>PrivilegedExceptionAction</code> with * privileges enabled and restricted by the specified ! * <code>AccessControlContext</code> and with a privilege scope limited by ! * specified <code>Permission</code> arguments. * * The action is performed with the intersection of the permissions * possessed by the caller's protection domain, and those possessed * by the domains represented by the specified ! * <code>AccessControlContext</code>. * <p> ! * If the action's <code>run</code> method throws an (unchecked) exception, * it will propagate through this method. * * <p> This method preserves the current AccessControlContext's * DomainCombiner (which may be null) while the action is performed. * * @param action the action to be performed. * @param context an <i>access control context</i> * representing the restriction to be applied to the * caller's domain's privileges before performing * the specified action. If the context is ! * <code>null</code>, * then no additional restriction is applied. ! * @param perms the <code>Permission</code> arguments which limit the * scope of the caller's privileges. The number of arguments * is variable. * ! * @return the value returned by the action's <code>run</code> method. * * @throws PrivilegedActionException if the specified action's ! * <code>run</code> method threw a <i>checked</i> exception * @throws NullPointerException if action or perms or any element of ! * perms is <code>null</code> * * @see #doPrivileged(PrivilegedAction) * @see #doPrivileged(PrivilegedAction,AccessControlContext) * @see java.security.DomainCombiner * --- 658,700 ---- return AccessController.doPrivileged(action, createWrapper(null, caller, parent, context, perms)); } /** ! * Performs the specified {@code PrivilegedExceptionAction} with * privileges enabled and restricted by the specified ! * {@code AccessControlContext} and with a privilege scope limited by ! * specified {@code Permission} arguments. * * The action is performed with the intersection of the permissions * possessed by the caller's protection domain, and those possessed * by the domains represented by the specified ! * {@code AccessControlContext}. * <p> ! * If the action's {@code run} method throws an (unchecked) exception, * it will propagate through this method. * * <p> This method preserves the current AccessControlContext's * DomainCombiner (which may be null) while the action is performed. * * @param action the action to be performed. * @param context an <i>access control context</i> * representing the restriction to be applied to the * caller's domain's privileges before performing * the specified action. If the context is ! * {@code null}, * then no additional restriction is applied. ! * @param perms the {@code Permission} arguments which limit the * scope of the caller's privileges. The number of arguments * is variable. * ! * @return the value returned by the action's {@code run} method. * * @throws PrivilegedActionException if the specified action's ! * {@code run} method threw a <i>checked</i> exception * @throws NullPointerException if action or perms or any element of ! * perms is {@code null} * * @see #doPrivileged(PrivilegedAction) * @see #doPrivileged(PrivilegedAction,AccessControlContext) * @see java.security.DomainCombiner *
*** 768,785 **** * specified permission should be allowed or denied, based on * the current AccessControlContext and security policy. * This method quietly returns if the access request * is permitted, or throws an AccessControlException otherwise. The * getPermission method of the AccessControlException returns the ! * <code>perm</code> Permission object instance. * * @param perm the requested permission. * * @exception AccessControlException if the specified permission * is not permitted, based on the current security policy. * @exception NullPointerException if the specified permission ! * is <code>null</code> and is checked based on the * security policy currently in effect. */ public static void checkPermission(Permission perm) throws AccessControlException --- 768,785 ---- * specified permission should be allowed or denied, based on * the current AccessControlContext and security policy. * This method quietly returns if the access request * is permitted, or throws an AccessControlException otherwise. The * getPermission method of the AccessControlException returns the ! * {@code perm} Permission object instance. * * @param perm the requested permission. * * @exception AccessControlException if the specified permission * is not permitted, based on the current security policy. * @exception NullPointerException if the specified permission ! * is {@code null} and is checked based on the * security policy currently in effect. */ public static void checkPermission(Permission perm) throws AccessControlException