RFR: 8364277: (fs) BasicFileAttributes.isDirectory and isOther return true for NTFS directory junctions when links not followed [v3]

Alan Bateman alanb at openjdk.org
Wed Aug 6 06:06:04 UTC 2025


On Wed, 6 Aug 2025 01:11:48 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Change `BasicFileAttributes` for Windows such that for a directory junction `isOther` returns `true` but all other `is*` methods return `false`. Without this change, `isDirectory` also returns `true`.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8364277: Clean up per reviewer comments

src/java.base/windows/classes/sun/nio/fs/WindowsFileAttributes.java line 419:

> 417:             return false;
> 418:         return ((fileAttrs & FILE_ATTRIBUTE_DIRECTORY) != 0 &&
> 419:                 (fileAttrs & FILE_ATTRIBUTE_REPARSE_POINT) != 0);

Should this just check if reparseTag has the value IO_REPARSE_TAG_MOUNT_POINT?

src/java.base/windows/classes/sun/nio/fs/WindowsFileAttributes.java line 436:

> 434:         if (isSymbolicLink())
> 435:             return false;
> 436:         return ((fileAttrs & FILE_ATTRIBUTE_DIRECTORY) != 0 &&

I assume it means that isDirectory no longer needs to use isSymbolicLink as the change means it will return false for all files that are reparse points.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26631#discussion_r2255946387
PR Review Comment: https://git.openjdk.org/jdk/pull/26631#discussion_r2255949663


More information about the nio-dev mailing list