JDK-5044858 : File.renameTo(File) should use MoveFileExW (win)
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2004-05-10
  • Updated: 2017-05-19
  • Resolved: 2009-02-16
Related Reports
Duplicate :  
Description
It looks like renameTo on Windows is not necessarily atomic, in particular
if the destination file exists there can be problems.  MoveFileEx is
supposedly the way to go and should give better results.

Comments
EVALUATION This feature has been addressed by the new file system API defined by JSR-203.
16-02-2009

EVALUATION In WinNTFileSystem and Win32FileSystem, we call the C Runtime _wrename() and rename() functions respectively. Although it appears that MoveFileExW does not provide any guarantees over the rename(), there are good reasons to not go through the C Runtime on windows if it's not necessary. Note that MoveFileExW does not exist for win9x so we'd have to change that code to use MoveFile.
26-10-2005

EVALUATION Will investigate this for the next release. ###@###.### 2004-05-10
10-05-2004