Bug 6030 - File can be renamed using a name that is already present in the folder.
File can be renamed using a name that is already present in the folder.
Status: CLOSED FIXED
Product: platform
Classification: Unclassified
Component: -- Other --
3.x
All All
: P1 (vote)
: TBD
Assigned To: Svata Dedic
issues@platform
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2000-03-24 01:56 UTC by Svata Dedic
Modified: 2008-12-23 11:50 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Svata Dedic 2000-03-24 01:56:18 UTC
I observed different behaviour on UNIX and Windows machines:

On Linux & Solaris, one can rename the file even if the new name is already used in the folder. No exception is thrown and no message box is displayed. The file that was `renamed` is DELETED from the
disk.

On Windows (NT), the first attempt to rename a file in the described way produces an error message box. If you try to rename it again, no message/exception is displayed and NO ACTION is taken. The fil
e`s name remains the same in the Explorer window and on the disk.

This bug dates at least from build 498 and is most probably in org.openide.filesystems.*.

[Svata] The behaviour on UNIXes seems to be related to OS function rename(from, to), that OVERWRITES the destination (unless the destination is directory) unlike Windows` RenameFile API function that
needs extra flag to overwrite the target. It seems that JDK`s File.renameTo directly calls underlying OS` implementation without abstracting different behaviour.
This is currently fixed by checking if the destination exists() and if so, throwing exception as if renameTo failed.
Comment 1 Marian Mirilovic 2002-01-22 13:04:16 UTC
verified, closed


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo