incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From timothyjw...@apache.org
Subject svn commit: r996886 - /incubator/aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/unit/impl/TempBundleDelegatingClassLoader.java
Date Tue, 14 Sep 2010 13:16:45 GMT
Author: timothyjward
Date: Tue Sep 14 13:16:44 2010
New Revision: 996886

URL: http://svn.apache.org/viewvc?rev=996886&view=rev
Log:
ARIES-407 - Java 2 security fix, tidy up patch and add some comments

Modified:
    incubator/aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/unit/impl/TempBundleDelegatingClassLoader.java

Modified: incubator/aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/unit/impl/TempBundleDelegatingClassLoader.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/unit/impl/TempBundleDelegatingClassLoader.java?rev=996886&r1=996885&r2=996886&view=diff
==============================================================================
--- incubator/aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/unit/impl/TempBundleDelegatingClassLoader.java
(original)
+++ incubator/aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/unit/impl/TempBundleDelegatingClassLoader.java
Tue Sep 14 13:16:44 2010
@@ -75,6 +75,8 @@ public class TempBundleDelegatingClassLo
   @Override
   protected URL findResource(final String resName)
   {
+    //Bundle.getResource requires privileges that the client may not have but we need
+    //use a doPriv so that only this bundle needs the privileges
     return AccessController.doPrivileged(new PrivilegedAction<URL>() {
 
       public URL run()
@@ -90,6 +92,8 @@ public class TempBundleDelegatingClassLo
   {
     Enumeration<URL> resources = null;
     try {
+      //Bundle.getResources requires privileges that the client may not have but we need
+      //use a doPriv so that only this bundle needs the privileges
       resources = AccessController.doPrivileged(new PrivilegedExceptionAction<Enumeration<URL>>()
{
 
         public Enumeration<URL> run() throws IOException
@@ -98,13 +102,14 @@ public class TempBundleDelegatingClassLo
         }
       });
     } catch(PrivilegedActionException pae) {
+      //thrownException can never be a RuntimeException, as that would escape
+      //the doPriv normally
       Exception thrownException = pae.getException();
-      if (thrownException instanceof RuntimeException) {
-        throw (RuntimeException)thrownException;
-      } else if (thrownException instanceof IOException) {
+      if (thrownException instanceof IOException) {
         throw (IOException)thrownException;
       } else {
-        // This code should never get called.
+        // This code should never get called, but we don't
+        // want to gobble the exception if we see it.
         throw new UndeclaredThrowableException(thrownException);
       }
     }



Mime
View raw message