RFR: 8154364: Files.isSameFile() throws NoSuchFileException with broken symbolic links [v3]
Alan Bateman
alanb at openjdk.org
Thu Aug 14 16:20:14 UTC 2025
On Thu, 14 Aug 2025 15:14:58 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> This request proposes to broaden the definition of which paths are considered to be the same by `java.nio.file.Files.isSameFile()`. A new test is added to cover many comparisons.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8154364: Propagate change of previous commit to Windows
src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java line 430:
> 428: // neither exist and comparison of normalized paths is problematic,
> 429: // so return false
> 430: return false;
I think you can drop "comparison of normalized paths is problematic" as it begs too many questions for anyone looking at this code.
src/java.base/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java line 423:
> 421: @Override
> 422: public boolean isSameFile(Path obj1, Path obj2) throws IOException {
> 423: // toWindowsPath verifies its argument is a non-null UnixPath
UnixPath - WindowsPath
src/java.base/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java line 435:
> 433: // check existence
> 434: boolean exists1 = exists(obj1);
> 435: boolean exists2 = exists(obj2);
exists does the openForReadAttributeAccess+readAttributes+CloseHandle so it looks like the change means it will do it twice for each file.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26736#discussion_r2277086814
PR Review Comment: https://git.openjdk.org/jdk/pull/26736#discussion_r2277084675
PR Review Comment: https://git.openjdk.org/jdk/pull/26736#discussion_r2277084346
More information about the nio-dev
mailing list