You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/05/18 03:08:56 UTC

svn commit: r170693 - /maven/components/trunk/maven-reports/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java

Author: brett
Date: Tue May 17 18:08:55 2005
New Revision: 170693

URL: http://svn.apache.org/viewcvs?rev=170693&view=rev
Log:
fix pmd report if the default source directory doesn't exist

Modified:
    maven/components/trunk/maven-reports/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java

Modified: maven/components/trunk/maven-reports/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-reports/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java?rev=170693&r1=170692&r2=170693&view=diff
==============================================================================
--- maven/components/trunk/maven-reports/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java (original)
+++ maven/components/trunk/maven-reports/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java Tue May 17 18:08:55 2005
@@ -33,18 +33,21 @@
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
 /**
  * Implement the PMD report.
  *
+ * @todo needs to support the multiple source roots
  * @author Brett Porter
  * @version $Id: PmdReport.java,v 1.3 2005/02/23 00:08:53 brett Exp $
  */
 public class PmdReport
     extends AbstractMavenReport
 {
+    /** @todo share, use default excludes from plexus utils. */
     protected static final String[] DEFAULT_EXCLUDES = {// Miscellaneous typical temporary files
         "**/*~", "**/#*#", "**/.#*", "**/%*%", "**/._*",
 
@@ -163,6 +166,12 @@
     private List getFilesToProcess( String includes, String excludes )
         throws IOException
     {
+        File dir = new File( getConfiguration().getSourceDirectory() );
+        if ( !dir.exists() )
+        {
+            return Collections.EMPTY_LIST;
+        }
+
         StringBuffer excludesStr = new StringBuffer();
         if ( StringUtils.isNotEmpty( excludes ) )
         {
@@ -177,7 +186,6 @@
             excludesStr.append( DEFAULT_EXCLUDES[i] );
         }
 
-        return FileUtils.getFiles( new File( getConfiguration().getSourceDirectory() ), includes,
-                                   excludesStr.toString() );
+        return FileUtils.getFiles( dir, includes, excludesStr.toString() );
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org