Description
As noted on the nio-discuss mailing lists, the moveTo method specifies that FileAlreadyExistsException is thrown if:
"the target file exists and cannot be replaced because the REPLACE_EXISTING option is not specified, or the target file is a non-empty directory"
The second part covers the "source.moveTo(target, REPLACE_EXISTING)" case and the target is a directory that cannot be replaced because it contains files. This statement should be re-examined. It would be more logical to list DirectoryNotEmptyException as an optional exception for this case. The copyTo method has the same issue.
"the target file exists and cannot be replaced because the REPLACE_EXISTING option is not specified, or the target file is a non-empty directory"
The second part covers the "source.moveTo(target, REPLACE_EXISTING)" case and the target is a directory that cannot be replaced because it contains files. This statement should be re-examined. It would be more logical to list DirectoryNotEmptyException as an optional exception for this case. The copyTo method has the same issue.
Attachments
Issue Links
- duplicates
-
JDK-7006126 (fs) Updates to file system API (1/2011)
- Closed