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

Roger Riggs rriggs at openjdk.org
Wed Nov 19 01:38:01 UTC 2025


On Tue, 18 Nov 2025 22:14:22 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Slightly changes the specification of `Files.createDirectory` to highlight that it fails if a filesystem entity already exists at the given location.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8220816: Update throws verbiage to match

src/java.base/share/classes/java/nio/file/Files.java line 640:

> 638:      *          when creating the directory
> 639:      * @throws  FileAlreadyExistsException
> 640:      *          if a directory could not otherwise be created because a file or

It is pre-existing wording, but I don't know that "otherwise" has any meaning here.
It reads the same whether "otherwise" is present or not.

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

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


More information about the nio-dev mailing list