Avoid possible NPEs.
MODIFY
src/main/java/org/apache/commons/io/file/CleaningPathVisitor.java
src/main/java/org/apache/commons/io/file/CleaningPathVisitor.java
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Arrays;
+import java.util.Objects;
import org.apache.commons.io.file.Counters.PathCounters;
@@ -73,7 +74,7 @@ public CleaningPathVisitor(final PathCounters pathCounter, final String... skip)
* @return true to process the given path, false if not.
*/
private boolean accept(final Path path) {
- return Arrays.binarySearch(skip, path.getFileName().toString()) < 0;
+ return Arrays.binarySearch(skip, Objects.toString(path.getFileName(), null)) < 0;
}
@Override

MODIFY
src/main/java/org/apache/commons/io/file/DeletingPathVisitor.java
src/main/java/org/apache/commons/io/file/DeletingPathVisitor.java
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Arrays;
+import java.util.Objects;
import org.apache.commons.io.file.Counters.PathCounters;
@@ -75,7 +76,7 @@ public DeletingPathVisitor(final PathCounters pathCounter, final String... skip)
* @return true to process the given path, false if not.
*/
private boolean accept(final Path path) {
- return Arrays.binarySearch(skip, path.getFileName().toString()) < 0;
+ return Arrays.binarySearch(skip, Objects.toString(path.getFileName(), null)) < 0;
}
@Override

Avoid possible NPEs.