RFR: 8364277: (fs) BasicFileAttributes.isDirectory and isOther return true for NTFS directory junctions when links not followed [v2]
Johannes Döbler
duke at openjdk.org
Tue Aug 5 19:44:09 UTC 2025
On Tue, 5 Aug 2025 19:28:25 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> test/lib/jdk/test/lib/util/FileUtils.java line 463:
>>
>>> 461: return createWinDirectoryJunction(junction, target);
>>> 462: } else {
>>> 463: Files.createSymbolicLink(Path.of(junction), Path.of(target));
>>
>> Suggestion: Junctions are Windows-only, so why not throw a RuntimeException for the non-windows case (and maybe also rename the method to something like `createWindowsDirectoryJunction`)
>
> A `RuntimeException` for non-Windows, i.e., Unix, would be a test failure and we can't have that. I think it would be better to convert the test to JUnit 5 and use [@EnabledOnOs(OS.WINDOWS)](https://docs.junit.org/5.2.0/api/org/junit/jupiter/api/condition/EnabledOnOs.html), but that might not be in this PR.
Right, but this method is just a helper method not a test method and the caller, e.g. Basic.attributeReadWriteTests|checkAttributesOfJunction should only call it if on Windows.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26631#discussion_r2255177168
More information about the nio-dev
mailing list