incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1589690 - in /sling/trunk/bundles/extensions/models: impl/src/main/java/org/apache/sling/models/impl/ integration-tests/ integration-tests/src/main/resources/ integration-tests/src/main/resources/org/ integration-tests/src/main/resources/o...
Date Thu, 24 Apr 2014 12:23:10 GMT
Author: justin
Date: Thu Apr 24 12:23:09 2014
New Revision: 1589690

URL: http://svn.apache.org/r1589690
Log:
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!

Added:
    sling/trunk/bundles/extensions/models/integration-tests/src/main/resources/
    sling/trunk/bundles/extensions/models/integration-tests/src/main/resources/org/
    sling/trunk/bundles/extensions/models/integration-tests/src/main/resources/org/apache/
    sling/trunk/bundles/extensions/models/integration-tests/src/main/resources/org/apache/sling/
    sling/trunk/bundles/extensions/models/integration-tests/src/main/resources/org/apache/sling/models/
    sling/trunk/bundles/extensions/models/integration-tests/src/main/resources/org/apache/sling/models/it/
    sling/trunk/bundles/extensions/models/integration-tests/src/main/resources/org/apache/sling/models/it/noclasses/
    sling/trunk/bundles/extensions/models/integration-tests/src/main/resources/org/apache/sling/models/it/noclasses/foo.txt
Modified:
    sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java
    sling/trunk/bundles/extensions/models/integration-tests/pom.xml

Modified: sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java?rev=1589690&r1=1589689&r2=1589690&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java
(original)
+++ sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelPackageBundleListener.java
Thu Apr 24 12:23:09 2014
@@ -57,8 +57,8 @@ public class ModelPackageBundleListener 
     
     @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 Arr
                 @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);

Modified: sling/trunk/bundles/extensions/models/integration-tests/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/integration-tests/pom.xml?rev=1589690&r1=1589689&r2=1589690&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/integration-tests/pom.xml (original)
+++ sling/trunk/bundles/extensions/models/integration-tests/pom.xml Thu Apr 24 12:23:09 2014
@@ -108,6 +108,8 @@
                 <configuration>
                     <instructions>
                         <Sling-Model-Packages>
+                            org.apache.sling.models.it.nonexisting,
+                            org.apache.sling.models.it.noclasses,
                             org.apache.sling.models.it.models
                         </Sling-Model-Packages>
                         <Sling-Test-Regexp>.*Test</Sling-Test-Regexp>
@@ -255,7 +257,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.models.impl</artifactId>
-            <version>1.0.1-SNAPSHOT</version>
+            <version>1.0.3-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         

Added: sling/trunk/bundles/extensions/models/integration-tests/src/main/resources/org/apache/sling/models/it/noclasses/foo.txt
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/integration-tests/src/main/resources/org/apache/sling/models/it/noclasses/foo.txt?rev=1589690&view=auto
==============================================================================
--- sling/trunk/bundles/extensions/models/integration-tests/src/main/resources/org/apache/sling/models/it/noclasses/foo.txt
(added)
+++ sling/trunk/bundles/extensions/models/integration-tests/src/main/resources/org/apache/sling/models/it/noclasses/foo.txt
Thu Apr 24 12:23:09 2014
@@ -0,0 +1 @@
+text file to ensure the package gets created, but without class files
\ No newline at end of file



Mime
View raw message