From 944082c53d0f527124819949203512dde894d9af Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 4 Sep 2015 21:11:49 +0200 Subject: [PATCH] Revert "Use Path instead of string to check file exclusions to fix windows-only bug where files were not being correctly excluded." This reverts commit 59fcd70c8d718624a3ab107440debbfab51e0c50. --- .../java/net/sourceforge/pmd/cpd/CPDConfiguration.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDConfiguration.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDConfiguration.java index ac871a9b0e..9b25d16402 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDConfiguration.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDConfiguration.java @@ -10,7 +10,6 @@ import java.io.FilenameFilter; import java.io.Reader; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.nio.file.Path; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; @@ -278,7 +277,7 @@ public class CPDConfiguration extends AbstractConfiguration { } final FilenameFilter languageFilter = language.getFileFilter(); - final Set exclusions = new HashSet(); + final Set exclusions = new HashSet(); if (excludes != null) { FileFinder finder = new FileFinder(); @@ -286,10 +285,10 @@ public class CPDConfiguration extends AbstractConfiguration { if (excludedFile.isDirectory()) { List files = finder.findFilesFrom(excludedFile, languageFilter, true); for (File f : files) { - exclusions.add(f.toPath()); + exclusions.add(f.getAbsolutePath()); } } else { - exclusions.add(excludedFile.toPath()); + exclusions.add(excludedFile.getAbsolutePath()); } } } @@ -297,7 +296,7 @@ public class CPDConfiguration extends AbstractConfiguration { FilenameFilter filter = new FilenameFilter() { public boolean accept(File dir, String name) { File f = new File(dir, name); - if (exclusions.contains(f.toPath())) { + if (exclusions.contains(f.getAbsolutePath())) { System.err.println("Excluding " + f.getAbsolutePath()); return false; }