A DESCRIPTION OF THE PROBLEM :
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#createDirectory(java.nio.file.Path,java.nio.file.attribute.FileAttribute...)
The Files.createDirectory method throws an exception when the directory already exists. This is not clearly described in its documentation:
1. The documentation itself does not mention that an exception is thrown, it is only described in @throws
2. The @throws documentation says:
> if a directory could not otherwise be created because a file of that name already exists
It is not clear that "file" also includes directory
The current behavior is only described by another method (Files.createDirectories):
> Unlike the createDirectory method, an exception is not thrown if the directory could not be created because it already exists.
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#createDirectory(java.nio.file.Path,java.nio.file.attribute.FileAttribute...)
The Files.createDirectory method throws an exception when the directory already exists. This is not clearly described in its documentation:
1. The documentation itself does not mention that an exception is thrown, it is only described in @throws
2. The @throws documentation says:
> if a directory could not otherwise be created because a file of that name already exists
It is not clear that "file" also includes directory
The current behavior is only described by another method (Files.createDirectories):
> Unlike the createDirectory method, an exception is not thrown if the directory could not be created because it already exists.
- links to