Skip to content

Commit 29b8891

Browse files
committed
Debug indexingRescanOnOverflow test
1 parent a76a4a4 commit 29b8891

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/main/java/engineering/swat/watch/impl/overflows/IndexingRescanner.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ public IndexingRescanner(Executor exec, Path path, WatchScope scope) {
5454
new Indexer(path, scope).walkFileTree(); // Make an initial scan to populate the index
5555
}
5656

57+
Set<BasicFileAttributes> attrsObjects = new HashSet<>();
58+
5759
private class Indexer extends BaseFileVisitor {
5860
public Indexer(Path path, WatchScope scope) {
5961
super(path, scope);
@@ -69,6 +71,12 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) th
6971

7072
@Override
7173
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
74+
75+
if (attrsObjects.contains(attrs)) {
76+
System.out.println("DUPLICATE ATTRS OBJECT");
77+
}
78+
attrsObjects.add(attrs);
79+
7280
index.put(file, attrs.lastModifiedTime());
7381
return FileVisitResult.CONTINUE;
7482
}
@@ -111,6 +119,17 @@ else if (lastModifiedTimeOld.compareTo(lastModifiedTimeNew) < 0) {
111119
}
112120
}
113121

122+
@Override
123+
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
124+
125+
if (attrsObjects.contains(attrs)) {
126+
System.out.println("DUPLICATE ATTRS OBJECT");
127+
}
128+
attrsObjects.add(attrs);
129+
130+
return super.visitFile(file, attrs);
131+
}
132+
114133
@Override
115134
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
116135
// If the visitor is back at the root of the rescan, then the time

0 commit comments

Comments
 (0)