This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.models.impl-1.0.4
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git

commit 4597b973d1180914a29c8f556eea687d9730901a
Author: Justin Edelson <[email protected]>
AuthorDate: Thu Apr 24 12:23:09 2014 +0000

    SLING-3510 - checking for bad package, either one which doesn't exist or 
doesn't have classes in it. Thanks Chris Pilsworth for the patch!
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/impl@1589690
 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/models/impl/ModelPackageBundleListener.java   | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java 
b/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java
index ba45ca0..f15ba38 100644
--- a/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java
+++ b/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java
@@ -57,8 +57,8 @@ public class ModelPackageBundleListener implements 
BundleTrackerCustomizer {
     
     @Override
     public Object addingBundle(Bundle bundle, BundleEvent event) {
-List<ServiceRegistration> regs = new ArrayList<ServiceRegistration>();
-        
+        List<ServiceRegistration> regs = new ArrayList<ServiceRegistration>();
+
         Dictionary<?, ?> headers = bundle.getHeaders();
         String packageList = PropertiesUtil.toString(headers.get(HEADER), 
null);
         if (packageList != null) {
@@ -69,6 +69,12 @@ List<ServiceRegistration> regs = new 
ArrayList<ServiceRegistration>();
                 @SuppressWarnings("unchecked")
                 Enumeration<URL> classUrls = bundle.findEntries("/" + 
singlePackage.replace('.', '/'), "*.class",
                         true);
+
+                if (classUrls == null) {
+                    log.warn("No adaptable classes found in package {}, 
ignoring", singlePackage);
+                    continue;
+                }
+
                 while (classUrls.hasMoreElements()) {
                     URL url = classUrls.nextElement();
                     String className = toClassName(url);

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to