sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject [sling-maven-sling-plugin] 24/28: Default resources directory might not exists.
Date Tue, 07 Nov 2017 09:16:37 GMT
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag maven-sling-plugin-2.0.4-incubator
in repository https://gitbox.apache.org/repos/asf/sling-maven-sling-plugin.git

commit e402842506dec390c9243d056104b4b88dc4d6c3
Author: Carsten Ziegeler <cziegeler@apache.org>
AuthorDate: Thu Apr 9 08:27:41 2009 +0000

    Default resources directory might not exists.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/maven/maven-sling-plugin@763554
13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/maven/bundlesupport/ValidationMojo.java  | 32 ++++++++++++----------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/src/main/java/org/apache/sling/maven/bundlesupport/ValidationMojo.java b/src/main/java/org/apache/sling/maven/bundlesupport/ValidationMojo.java
index 39ce9f7..8cd8479 100644
--- a/src/main/java/org/apache/sling/maven/bundlesupport/ValidationMojo.java
+++ b/src/main/java/org/apache/sling/maven/bundlesupport/ValidationMojo.java
@@ -80,25 +80,27 @@ public class ValidationMojo extends AbstractMojo {
         while ( rsrcIterator.hasNext() ) {
             final Resource rsrc = rsrcIterator.next();
 
-            getLog().debug("Scanning " + rsrc.getDirectory());
             final File directory = new File(rsrc.getDirectory());
-            final DirectoryScanner scanner = new DirectoryScanner();
-            scanner.setBasedir( directory );
+            if ( directory.exists() ) {
+                getLog().debug("Scanning " + rsrc.getDirectory());
+                final DirectoryScanner scanner = new DirectoryScanner();
+                scanner.setBasedir( directory );
 
-            if ( rsrc.getExcludes() != null && rsrc.getExcludes().size() > 0 )
{
-                scanner.setExcludes( (String[]) rsrc.getExcludes().toArray(new String[rsrc.getExcludes().size()]
) );
-            }
-            scanner.addDefaultExcludes();
-            if ( rsrc.getIncludes() != null && rsrc.getIncludes().size() > 0 )
{
-                scanner.setIncludes( (String[]) rsrc.getIncludes().toArray(new String[rsrc.getIncludes().size()]
));
-            }
+                if ( rsrc.getExcludes() != null && rsrc.getExcludes().size() >
0 ) {
+                    scanner.setExcludes( (String[]) rsrc.getExcludes().toArray(new String[rsrc.getExcludes().size()]
) );
+                }
+                scanner.addDefaultExcludes();
+                if ( rsrc.getIncludes() != null && rsrc.getIncludes().size() >
0 ) {
+                    scanner.setIncludes( (String[]) rsrc.getIncludes().toArray(new String[rsrc.getIncludes().size()]
));
+                }
 
-            scanner.scan();
+                scanner.scan();
 
-            final String[] files = scanner.getIncludedFiles();
-            if ( files != null ) {
-                for(int m=0; m<files.length; m++) {
-                    this.validate(directory, files[m]);
+                final String[] files = scanner.getIncludedFiles();
+                if ( files != null ) {
+                    for(int m=0; m<files.length; m++) {
+                        this.validate(directory, files[m]);
+                    }
                 }
             }
         }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <commits@sling.apache.org>.

Mime
View raw message