Squelching prior notified loop detection

This commit is contained in:
Joakim Erdfelt 2014-04-08 06:11:42 -07:00
parent 9d0143b704
commit 87f2deed65
1 changed files with 10 additions and 1 deletions

View File

@ -29,11 +29,16 @@ import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class PathFinder extends SimpleFileVisitor<Path>
{
// internal tracking of prior notified paths (to avoid repeated notification of same ignored path)
private static Set<Path> NOTIFIED_PATHS = new HashSet<>();
private boolean includeDirsInResults = false;
private Map<String, Path> hits = new HashMap<>();
private Path basePath = null;
@ -149,7 +154,11 @@ public class PathFinder extends SimpleFileVisitor<Path>
{
if (exc instanceof FileSystemLoopException)
{
StartLog.warn("skipping detected filesystem loop: " + file);
if (!NOTIFIED_PATHS.contains(file))
{
StartLog.warn("skipping detected filesystem loop: " + file);
NOTIFIED_PATHS.add(file);
}
return FileVisitResult.SKIP_SUBTREE;
}
else