RFR: 8069345: (fs) FileTreeWalker throws NotDirectoryException on file junction points
Brian Burkhalter
bpb at openjdk.org
Thu Oct 17 00:10:24 UTC 2024
On Thu, 17 Oct 2024 00:05:26 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> Improve support for Windows directory junctions.
A Windows directory junction is an empty (void) directory which has a reparse point with tag `IO_REPARSE_TAG_MOUNT_POINT` and a data buffer containing the name of the target of the junction, which must be an absolute path beginning with a drive letter. The absolute path is usually expected to be to a directory, although it is possible, but perhaps non-standard, that it could be to a regular file. At present, directory junctions are in general handled transparently by Java in the same manner as symbolic links.
This request proposes to make directory junctions be seen as symbolic links by having `Files.isSymbolicLink(junction)` return `true` and to return the target of the directory junction from `Files.readSymbolicLink(junction)`. The behaviors of these two methods are the only visible changes.
Two tests are added to verify the expected behavior with junctions, one for `java.io` and the other for `java.nio.file`. Both of these tests already pass without the proposed source changes except for the sub-tests which verify the changes underlying the `Files.isSymbolicLink` and `Files.readSymbolicLink` methods on Windows.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21555#issuecomment-2418188336
More information about the core-libs-dev
mailing list