You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/04/18 19:16:10 UTC
svn commit: r649616 -
/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdReport.java
Author: bentmann
Date: Fri Apr 18 10:16:03 2008
New Revision: 649616
URL: http://svn.apache.org/viewvc?rev=649616&view=rev
Log:
[MPMD-77] excludeRoots doesn't work with basedir-relative paths
Submitted by: Justin Edelson
Reviewed by: Benjamin Bentmann
Modified:
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdReport.java
Modified: maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdReport.java?rev=649616&r1=649615&r2=649616&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdReport.java (original)
+++ maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdReport.java Fri Apr 18 10:16:03 2008
@@ -22,7 +22,9 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -154,7 +156,7 @@
* @parameter
* @since 2.2
*/
- private List excludeRoots;
+ private File[] excludeRoots;
/**
* Run PMD on the tests.
@@ -257,16 +259,14 @@
if ( excludeRoots == null )
{
- excludeRoots = Collections.EMPTY_LIST;
+ excludeRoots = new File[0];
}
- List excludeRootFiles = new ArrayList( excludeRoots.size() );
+ Collection excludeRootFiles = new HashSet( excludeRoots.length );
- for ( Iterator it = excludeRoots.iterator(); it.hasNext(); )
+ for ( int i = 0; i < excludeRoots.length; i++ )
{
- String root = (String) it.next();
- File file = new File( root );
- if ( file.exists()
- && file.isDirectory() )
+ File file = excludeRoots[i];
+ if ( file.isDirectory() )
{
excludeRootFiles.add( file );
}
@@ -343,9 +343,7 @@
{
PmdFileInfo finfo = (PmdFileInfo) it.next();
File sourceDirectory = finfo.getSourceDirectory();
- if ( sourceDirectory.exists()
- && sourceDirectory.isDirectory()
- && !excludeRootFiles.contains( sourceDirectory ) )
+ if ( sourceDirectory.isDirectory() && !excludeRootFiles.contains( sourceDirectory ) )
{
List newfiles = FileUtils.getFiles( sourceDirectory, including, excludesStr.toString() );
for ( Iterator it2 = newfiles.iterator(); it2.hasNext(); )