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 5a0096d [IO-741] FileUtils.listFiles does not list matching files if
File parameter is a symbolic link.
5a0096d is described below
commit 5a0096d9b8f25b271a6abe717f57693235272d7b
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Jun 30 10:01:29 2021 -0400
[IO-741] FileUtils.listFiles does not list matching files if File
parameter is a symbolic link.
---
src/changes/changes.xml | 9 ++++++---
src/main/java/org/apache/commons/io/FileUtils.java | 4 +++-
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 0d9edbf..36f492c 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -47,15 +47,18 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="2.11.0" date="2021-MM-DD" description="Java 8 required.">
<!-- FIX -->
- <action dev="ggregory" type="fix" due-to="Arturo Bernal">
- Minor changes #243.
+ <action issue="IO-741" dev="ggregory" type="fix" due-to="Zach Sherman">
+ FileUtils.listFiles does not list matching files if File parameter is
a symbolic link.
</action>
<action issue="IO-724" dev="ggregory" type="fix" due-to="liran2000">
FileUtils#deleteDirectory(File) exception Javadoc inaccurate update
#245.
</action>
+ <action dev="ggregory" type="fix" due-to="Arturo Bernal">
+ Minor changes #243.
+ </action>
<!-- ADD -->
<action dev="ggregory" type="update" due-to="Gary Gregory">
- Add SymbolicLinkFileFilter.
+ Add SymbolicLinkFileFilter.
</action>
<action dev="ggregory" type="update" due-to="trncate">
Add test to make sure the setter of AndFileFilter works correctly #244.
diff --git a/src/main/java/org/apache/commons/io/FileUtils.java
b/src/main/java/org/apache/commons/io/FileUtils.java
index f5198c9..21d29e7 100644
--- a/src/main/java/org/apache/commons/io/FileUtils.java
+++ b/src/main/java/org/apache/commons/io/FileUtils.java
@@ -36,6 +36,7 @@ import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.charset.UnsupportedCharsetException;
import java.nio.file.CopyOption;
+import java.nio.file.FileVisitOption;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.NotDirectoryException;
@@ -2967,7 +2968,8 @@ public class FileUtils {
throws IOException {
final IOFileFilter filter = extensions == null ?
FileFileFilter.INSTANCE
: FileFileFilter.INSTANCE.and(new
SuffixFileFilter(toSuffixes(extensions)));
- return PathUtils.walk(directory.toPath(), filter,
toMaxDepth(recursive), false).map(Path::toFile);
+ return PathUtils.walk(directory.toPath(), filter,
toMaxDepth(recursive), false, FileVisitOption.FOLLOW_LINKS)
+ .map(Path::toFile);
}
/**