RFR: 8220816: (fs) Files.createDirectory should make it more obvious that it fails when the directory already exists [v4]

Brian Burkhalter bpb at openjdk.org
Wed Nov 19 19:17:23 UTC 2025


On Wed, 19 Nov 2025 18:50:39 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8220816: Improve consistency per review comments
>
> src/java.base/share/classes/java/nio/file/Files.java line 681:
> 
>> 679:      *          when creating the directory
>> 680:      * @throws  FileAlreadyExistsException
>> 681:      *          if {@code dir} locates an existing file but is not a directory
> 
> Maybe "that is not a directory" might be better.

Fixed in 9cf6ede.

> src/java.base/share/classes/java/nio/file/Files.java line 985:
> 
>> 983:     /**
>> 984:      * Creates a new link (directory entry) for an existing file,
>> 985:     * failing if {@code link} locates an existing file <i>(optional
> 
> Minor nit, I think the comment has got mis-aligned.

Fixed in 9cf6ede.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28378#discussion_r2543247140
PR Review Comment: https://git.openjdk.org/jdk/pull/28378#discussion_r2543247558


More information about the nio-dev mailing list