142 |
* @param action the <code>PrivilegedExceptionAction</code> whose |
* @param action the <code>PrivilegedExceptionAction</code> whose |
143 |
* <code>run()</code> should be be called. |
* <code>run()</code> should be be called. |
144 |
* @return the result of the <code>action.run()</code> method. |
* @return the result of the <code>action.run()</code> method. |
145 |
* @exception PrivilegedActionException wrapped around any exception that |
* @exception PrivilegedActionException wrapped around any checked exception |
146 |
* is thrown in the <code>run()</code> method. |
* that is thrown in the <code>run()</code> method. |
147 |
*/ |
*/ |
148 |
public static Object doPrivileged(PrivilegedExceptionAction action) |
public static Object doPrivileged(PrivilegedExceptionAction action) |
149 |
throws PrivilegedActionException |
throws PrivilegedActionException |
153 |
{ |
{ |
154 |
return action.run(); |
return action.run(); |
155 |
} |
} |
156 |
|
catch (RuntimeException e) |
157 |
|
{ |
158 |
|
throw e; |
159 |
|
} |
160 |
catch (Exception e) |
catch (Exception e) |
161 |
{ |
{ |
162 |
throw new PrivilegedActionException(e); |
throw new PrivilegedActionException(e); |
182 |
* @param context the <code>AccessControlContext</code> whose protection |
* @param context the <code>AccessControlContext</code> whose protection |
183 |
* domains should be added to the protection domain of the calling class. |
* domains should be added to the protection domain of the calling class. |
184 |
* @return the result of the <code>action.run()</code> method. |
* @return the result of the <code>action.run()</code> method. |
185 |
* @exception PrivilegedActionException wrapped around any exception that |
* @exception PrivilegedActionException wrapped around any checked exception |
186 |
* is thrown in the <code>run()</code> method. |
* that is thrown in the <code>run()</code> method. |
187 |
*/ |
*/ |
188 |
public static Object doPrivileged(PrivilegedExceptionAction action, |
public static Object doPrivileged(PrivilegedExceptionAction action, |
189 |
AccessControlContext context) |
AccessControlContext context) |
194 |
{ |
{ |
195 |
return action.run(); |
return action.run(); |
196 |
} |
} |
197 |
|
catch (RuntimeException e) |
198 |
|
{ |
199 |
|
throw e; |
200 |
|
} |
201 |
catch (Exception e) |
catch (Exception e) |
202 |
{ |
{ |
203 |
throw new PrivilegedActionException(e); |
throw new PrivilegedActionException(e); |