JDK-6895012 : (fs spec) Re-visit Path.copyTo/moveTo spec for case that target exists and is non-empty directory
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2009-10-25
  • Updated: 2011-01-19
  • Resolved: 2011-01-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7Resolved
Related Reports
Duplicate :  
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.

Comments
EVALUATION This will be fixed as part of the API updates coming in 7006126.
19-01-2011

EVALUATION Yes, it would be nicer if DirectoryNotEmptyException were thrown for this case.
21-10-2010