This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git


The following commit(s) were added to refs/heads/master by this push:
     new 0fa5a39  Avoid possible NPEs.
0fa5a39 is described below

commit 0fa5a395f5396c9968af30306ce3f6cc89c0d463
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sun May 24 14:04:49 2020 -0400

    Avoid possible NPEs.
---
 src/main/java/org/apache/commons/io/file/CleaningPathVisitor.java | 3 ++-
 src/main/java/org/apache/commons/io/file/DeletingPathVisitor.java | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/file/CleaningPathVisitor.java 
b/src/main/java/org/apache/commons/io/file/CleaningPathVisitor.java
index 12c8406..f56ee7d 100644
--- a/src/main/java/org/apache/commons/io/file/CleaningPathVisitor.java
+++ b/src/main/java/org/apache/commons/io/file/CleaningPathVisitor.java
@@ -23,6 +23,7 @@ import java.nio.file.Files;
 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 class CleaningPathVisitor extends CountingPathVisitor {
      * @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
diff --git a/src/main/java/org/apache/commons/io/file/DeletingPathVisitor.java 
b/src/main/java/org/apache/commons/io/file/DeletingPathVisitor.java
index ba827eb..2d6405d 100644
--- a/src/main/java/org/apache/commons/io/file/DeletingPathVisitor.java
+++ b/src/main/java/org/apache/commons/io/file/DeletingPathVisitor.java
@@ -23,6 +23,7 @@ import java.nio.file.Files;
 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 class DeletingPathVisitor extends CountingPathVisitor {
      * @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

Reply via email to