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 02e5f1297 Tests IO-872 PathUtils.directoryAndFileContentEquals doesn't work across FileSystems. 02e5f1297 is described below commit 02e5f129706a9c99b5c10fb9357ba7e623aab623 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Thu Apr 3 09:42:56 2025 -0400 Tests IO-872 PathUtils.directoryAndFileContentEquals doesn't work across FileSystems. WindowsPath and ZipPath equals() methods always return false if the argument is not of the same instance as itself. --- .../commons/io/file/PathUtilsContentEqualsTest.java | 18 ++++++++++++++++++ src/test/resources/dir-equals-tests.zip | Bin 0 -> 8972 bytes 2 files changed, 18 insertions(+) diff --git a/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java b/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java index 387692676..baa99cb09 100644 --- a/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java +++ b/src/test/java/org/apache/commons/io/file/PathUtilsContentEqualsTest.java @@ -29,6 +29,7 @@ import java.nio.file.Path; import java.nio.file.Paths; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -100,6 +101,23 @@ public void testDirectoryAndFileContentEquals() throws Exception { } } + /** + * Tests IO-872 PathUtils.directoryAndFileContentEquals doesn't work across FileSystems. + * + * @throws Exception on test failure. + */ + @Disabled + @Test + public void testDirectoryAndFileContentEqualsDifferentFileSystems() throws Exception { + final Path dir1 = Paths.get("src/test/resources/dir-equals-tests"); + try (FileSystem fileSystem = FileSystems.newFileSystem(dir1.resolveSibling(dir1.getFileName() + ".zip"), null)) { + final Path dir2 = fileSystem.getPath("/dir-equals-tests"); + // WindowsPath and ZipPath equals() methods always return false if the argument is not of the same instance as itself. + assertTrue(PathUtils.directoryAndFileContentEquals(dir1, dir2)); + } + } + + @Test public void testDirectoryContentEquals() throws Exception { // Non-existent files diff --git a/src/test/resources/dir-equals-tests.zip b/src/test/resources/dir-equals-tests.zip new file mode 100644 index 000000000..7eb7ce09c Binary files /dev/null and b/src/test/resources/dir-equals-tests.zip differ