Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import org.apache.commons.io.file.Counters.PathCounters;
import org.apache.commons.io.filefilter.IOFileFilter;
import org.apache.commons.io.filefilter.SymbolicLinkFileFilter;
import org.apache.commons.io.filefilter.TrueFileFilter;
import org.apache.commons.io.function.IOBiFunction;

Expand Down Expand Up @@ -152,7 +151,7 @@ static UnaryOperator<Path> defaultDirectoryTransformer() {
}

static IOFileFilter defaultFileFilter() {
return new SymbolicLinkFileFilter(FileVisitResult.TERMINATE, FileVisitResult.CONTINUE);
return TrueFileFilter.INSTANCE;
}

static PathCounters defaultPathCounters() {
Expand Down
11 changes: 6 additions & 5 deletions src/test/java/org/apache/commons/io/FileUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2986,10 +2986,10 @@ void testSizeOfDirectory() throws Exception {
// Create a cyclic symlink
final Path linkPath = createCircularSymbolicLink(file);
try {
assertEquals(TEST_DIRECTORY_SIZE, FileUtils.sizeOfDirectory(file), "Unexpected directory size");
// Different result value depending on the Java version and operating system, but should not throw an exception or loop infinitely.
FileUtils.sizeOfDirectory(file);
} finally {
Files.deleteIfExists(linkPath);
assertDelete(true, file);
}
}

Expand All @@ -3014,7 +3014,8 @@ void testSizeOfDirectoryAsBigInteger() throws Exception {
assertMkdir(true, file);
final Path linkPath = createCircularSymbolicLink(file);
try {
assertEquals(TEST_DIRECTORY_SIZE_BI, FileUtils.sizeOfDirectoryAsBigInteger(file), "Unexpected directory size");
// Different result value depending on the Java version and operating system, but should not throw an exception or loop infinitely.
FileUtils.sizeOfDirectoryAsBigInteger(file);
assertDelete(false, file);
assertMkdir(false, file);
final File nonEmptyFile = new File(file, "non-emptyFile" + System.nanoTime());
Expand All @@ -3025,12 +3026,12 @@ void testSizeOfDirectoryAsBigInteger() throws Exception {
} finally {
IOUtils.closeQuietly(output);
}
assertEquals(TEST_DIRECTORY_SIZE_GT_ZERO_BI, FileUtils.sizeOfDirectoryAsBigInteger(file), "Unexpected directory size");
// Different result value depending on the Java version and operating system, but should not throw an exception or loop infinitely.
FileUtils.sizeOfDirectoryAsBigInteger(file);
assertDelete(true, nonEmptyFile);
assertDelete(false, file);
} finally {
Files.deleteIfExists(linkPath);
assertDelete(true, file);
}
}

Expand Down
Loading
Loading