This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 6030 - File can be renamed using a name that is already present in the folder.
Summary: File can be renamed using a name that is already present in the folder.
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: All All
: P1 major (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
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
Exception Reporter:


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