classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] RFC: runtime exceptions thrown in AccessController


From: Mark Wielaard
Subject: Re: [cp-patches] RFC: runtime exceptions thrown in AccessController
Date: Wed, 05 Oct 2005 23:22:06 +0200

Hi Nicolas,

On Wed, 2005-10-05 at 18:23 +0200, Nicolas Geoffray wrote:
> I changed implementation of AccessController.doPrivileged methods that 
> hava a PrivilegedExceptionAction argument. When a runtime exception is 
> catched, it throws it, and doesn't wrap it in a 
> PrivilegedExceptionAction object.
> 
> I'm new in committing. Should I get a write access to the cvs?

Thanks. I wrote a mauve test for it to check that the problem was really
solved. And updated the documentation.

Committed as follows:

2005-10-05  Mark Wielaard  <address@hidden>

        Reported by Nicolas Geoffray  <address@hidden>
        * java/security/AccessController.java
        (doPrivileged(PrivilegedExceptionAction)): If the Exception is a
        Runtime exception, then throw the exception directly, otherwise
        wrap it.
        (doPrivileged(PrivilegedExceptionAction,AccessControlContext)):
        Likewise.

For these kind of small, obviously correct patches we can just check
them in. If you want to contribute larger patches please read:
http://www.gnu.org/software/classpath/docs/hacking.html

Thanks,

Mark
Index: java/security/AccessController.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/security/AccessController.java,v
retrieving revision 1.10
diff -u -r1.10 AccessController.java
--- java/security/AccessController.java 2 Jul 2005 20:32:40 -0000       1.10
+++ java/security/AccessController.java 5 Oct 2005 21:21:20 -0000
@@ -142,8 +142,8 @@
    * @param action the <code>PrivilegedExceptionAction</code> whose
    * <code>run()</code> should be be called.
    * @return the result of the <code>action.run()</code> method.
-   * @exception PrivilegedActionException wrapped around any exception that
-   * is thrown in the <code>run()</code> method.
+   * @exception PrivilegedActionException wrapped around any checked exception
+   * that is thrown in the <code>run()</code> method.
    */
   public static Object doPrivileged(PrivilegedExceptionAction action)
     throws PrivilegedActionException
@@ -153,6 +153,10 @@
       {
         return action.run();
       }
+    catch (RuntimeException e)
+      {
+       throw e;
+      }
     catch (Exception e)
       {
         throw new PrivilegedActionException(e);
@@ -178,8 +182,8 @@
    * @param context the <code>AccessControlContext</code> whose protection
    * domains should be added to the protection domain of the calling class.
    * @return the result of the <code>action.run()</code> method.
-   * @exception PrivilegedActionException wrapped around any exception that
-   * is thrown in the <code>run()</code> method.
+   * @exception PrivilegedActionException wrapped around any checked exception
+   * that is thrown in the <code>run()</code> method.
    */
   public static Object doPrivileged(PrivilegedExceptionAction action,
                                     AccessControlContext context)
@@ -189,6 +193,10 @@
     try
       {
         return action.run();
+      }
+    catch (RuntimeException e)
+      {
+       throw e;
       }
     catch (Exception e)
       {

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]