incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1176288 - in /sling/trunk/bundles/commons/classloader/src: main/java/org/apache/sling/commons/classloader/impl/PackageAdminClassLoader.java test/java/org/apache/sling/commons/classloader/impl/ClassLoadingTest.java
Date Tue, 27 Sep 2011 09:08:05 GMT
Author: cziegeler
Date: Tue Sep 27 09:08:05 2011
New Revision: 1176288

URL: http://svn.apache.org/viewvc?rev=1176288&view=rev
Log:
SLING-2232 : Package admin classloader should check bundle state

Modified:
    sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/PackageAdminClassLoader.java
    sling/trunk/bundles/commons/classloader/src/test/java/org/apache/sling/commons/classloader/impl/ClassLoadingTest.java

Modified: sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/PackageAdminClassLoader.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/PackageAdminClassLoader.java?rev=1176288&r1=1176287&r2=1176288&view=diff
==============================================================================
--- sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/PackageAdminClassLoader.java
(original)
+++ sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/PackageAdminClassLoader.java
Tue Sep 27 09:08:05 2011
@@ -67,7 +67,15 @@ class PackageAdminClassLoader extends Cl
      */
     private Bundle findBundleForPackage(final String pckName) {
         final ExportedPackage exportedPackage = this.packageAdmin.getExportedPackage(pckName);
-        final Bundle bundle = (exportedPackage == null ? null : exportedPackage.getExportingBundle());
+        Bundle bundle = null;
+        if (exportedPackage != null && !exportedPackage.isRemovalPending() ) {
+            bundle = exportedPackage.getExportingBundle();
+            if ( bundle != null ) {
+                if ( bundle.getState() != Bundle.ACTIVE ) {
+                    bundle = null;
+                }
+            }
+        }
         return bundle;
     }
 

Modified: sling/trunk/bundles/commons/classloader/src/test/java/org/apache/sling/commons/classloader/impl/ClassLoadingTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/classloader/src/test/java/org/apache/sling/commons/classloader/impl/ClassLoadingTest.java?rev=1176288&r1=1176287&r2=1176288&view=diff
==============================================================================
--- sling/trunk/bundles/commons/classloader/src/test/java/org/apache/sling/commons/classloader/impl/ClassLoadingTest.java
(original)
+++ sling/trunk/bundles/commons/classloader/src/test/java/org/apache/sling/commons/classloader/impl/ClassLoadingTest.java
Tue Sep 27 09:08:05 2011
@@ -61,8 +61,12 @@ public class ClassLoadingTest {
             will(returnValue(ep));
             allowing(ep).getExportingBundle();
             will(returnValue(bundle));
+            allowing(ep).isRemovalPending();
+            will(returnValue(false));
             allowing(bundle).getBundleId();
             will(returnValue(2L));
+            allowing(bundle).getState();
+            will(returnValue(Bundle.ACTIVE));
             one(bundle).loadClass("org.apache.sling.test.A"); inSequence(sequence);
             will(returnValue(java.util.Map.class));
             one(bundle).loadClass("org.apache.sling.test.A"); inSequence(sequence);



Mime
View raw message