RFR: 8339574: Behavior of File.is{Directory,File,Hidden} is not documented with respect to symlinks [v6]

Brian Burkhalter bpb at openjdk.org
Mon Sep 16 23:23:11 UTC 2024


On Sat, 14 Sep 2024 07:03:05 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8339574: Move symbolic link verbiage from class to constructor doc in FIS/FOS/RAF
>
> src/java.base/share/classes/java/io/FileOutputStream.java line 103:
> 
>> 101:      * are automatically redirected to the <i>target</i> of the link.
>> 102:      * If the file or link target exists, then it will be truncated.
>> 103:      * A new {@code FileDescriptor} object is
> 
> This wording gives the impression that a link can be truncated :-)
> 
> I think the second sentence needs to say that it truncates an existing file, otherwise creates a new file. Then follow with the sentence on sym link behavior.

Fixed in a6c2168.

> src/java.base/share/classes/java/io/RandomAccessFile.java line 108:
> 
>> 106:      * are automatically redirected to the <i>target</i> of the link.
>> 107:      * If the access mode specifies writing and the file or link target exists,
>> 108:      * then it will be truncated.
> 
> I think you've copied the text from FOS but it doesn't work here as RAF doesn't truncate.
> 
> For "r" mode, it opens an existing file. For the "rw" and variants, it opens an existing file, or creates a new file if it doesn't exist.

Fixed in a6c2168.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20878#discussion_r1762073357
PR Review Comment: https://git.openjdk.org/jdk/pull/20878#discussion_r1762073459


More information about the core-libs-dev mailing list