incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1301452 - /sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/PackageAdminClassLoader.java
Date Fri, 16 Mar 2012 12:13:56 GMT
Author: cziegeler
Date: Fri Mar 16 12:13:56 2012
New Revision: 1301452

URL: http://svn.apache.org/viewvc?rev=1301452&view=rev
Log:
SLING-2438 : Class might never be loaded if the bundle is in state resolved on the first attempt

Modified:
    sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/PackageAdminClassLoader.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=1301452&r1=1301451&r2=1301452&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
Fri Mar 16 12:13:56 2012
@@ -103,6 +103,9 @@ class PackageAdminClassLoader extends Cl
         Bundle bundle = null;
         if (exportedPackage != null && !exportedPackage.isRemovalPending() ) {
             bundle = exportedPackage.getExportingBundle();
+            if ( !this.isBundleActive(bundle) ) {
+                bundle = null;
+            }
         }
         return bundle;
     }
@@ -137,7 +140,7 @@ class PackageAdminClassLoader extends Cl
         Enumeration<URL> e = super.getResources(name);
         if ( e == null || !e.hasMoreElements() ) {
             final Bundle bundle = this.findBundleForPackage(getPackageFromResource(name));
-            if ( this.isBundleActive(bundle) ) {
+            if ( bundle != null ) {
                 e = bundle.getResources(name);
                 if ( e != null && e.hasMoreElements() ) {
                     this.factory.addUsedBundle(bundle);
@@ -158,7 +161,7 @@ class PackageAdminClassLoader extends Cl
         URL url = super.findResource(name);
         if ( url == null ) {
             final Bundle bundle = this.findBundleForPackage(getPackageFromResource(name));
-            if ( this.isBundleActive(bundle) ) {
+            if ( bundle != null ) {
                 url = bundle.getResource(name);
                 if ( url != null ) {
                     this.factory.addUsedBundle(bundle);
@@ -182,7 +185,7 @@ class PackageAdminClassLoader extends Cl
             clazz = super.findClass(name);
         } catch (ClassNotFoundException cnfe) {
             final Bundle bundle = this.findBundleForPackage(getPackageFromClassName(name));
-            if ( this.isBundleActive(bundle) ) {
+            if ( bundle != null ) {
                 clazz = bundle.loadClass(name);
                 this.factory.addUsedBundle(bundle);
             }
@@ -211,7 +214,7 @@ class PackageAdminClassLoader extends Cl
         } catch (final ClassNotFoundException cnfe) {
             final String pckName = getPackageFromClassName(name);
             final Bundle bundle = this.findBundleForPackage(pckName);
-            if ( this.isBundleActive(bundle) ) {
+            if ( bundle != null ) {
                 try {
                     clazz = bundle.loadClass(name);
                     this.factory.addUsedBundle(bundle);



Mime
View raw message