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 224780 - Undo Rename Package Name Creates Extraneous Project Folder
Summary: Undo Rename Package Name Creates Extraneous Project Folder
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-12 14:38 UTC by MackSix
Modified: 2015-09-17 11:15 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
log file (45.40 KB, text/plain)
2013-01-12 14:38 UTC, MackSix
Details
project for reproduction of bug (29.75 KB, application/octet-stream)
2013-01-12 14:39 UTC, MackSix
Details
screenshot (83.81 KB, image/png)
2013-01-12 14:39 UTC, MackSix
Details
logfile 7.3 RC1 (39.45 KB, text/plain)
2013-01-12 14:52 UTC, MackSix
Details
correct logfile 7.3 RC1 (Build 201301172100) (168.78 KB, text/plain)
2013-01-20 17:34 UTC, MackSix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MackSix 2013-01-12 14:38:25 UTC
Created attachment 130130 [details]
log file

1. Open attached project in Netbeans.
2. Rename Project JavaApplication1 to JavaApplication21 (Also choose rename folder).
3. Rename Package javaapplication1 to javaapplicatoin21
4. Repeat steps 1 & 2 changing 21 to 22.
5. close project and then reopen it.
6. Click undo button.
7. Click undo button again.
8. Notice that there is an extraneous folder created named JavaApplication21/src/javaapplicaion1 in the project directory on the system drive that is empty. This is not expected.

Workaround: Delete the extraneous folder from system drive.

See attached logfile and screenshot.

Product Version: NetBeans IDE 7.3 Beta 2 (Build 201211062253)
Updates: NetBeans IDE is updated to version , NetBeans 7.3 Beta 2
Java: 1.7.0_10; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-b18
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 MackSix 2013-01-12 14:39:15 UTC
Created attachment 130131 [details]
project for reproduction of bug
Comment 2 MackSix 2013-01-12 14:39:40 UTC
Created attachment 130132 [details]
screenshot
Comment 3 MackSix 2013-01-12 14:51:31 UTC
Bug valid in 7.2 RC1.

Product Version: NetBeans IDE 7.3 RC1 (Build 201301102100)
Java: 1.7.0_10; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-b18
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)

Logfile attached.
Comment 4 MackSix 2013-01-12 14:52:02 UTC
Created attachment 130133 [details]
logfile 7.3 RC1
Comment 5 MackSix 2013-01-12 15:48:45 UTC
Attachment 130133 [details] (logfile 7.3 RC1) is the wrong log file. I will post the correct log file later.
Comment 6 MackSix 2013-01-20 17:34:43 UTC
Created attachment 130422 [details]
correct logfile 7.3 RC1 (Build 201301172100)

This time it also left an extraneous package folder "javaapplication24" inside of the valid project folder after undoing the renaming of packages.
Comment 7 MackSix 2013-08-30 17:44:03 UTC
Still valid in Netbeans 7.4, but not critical.

I understand what is going on now, the renaming of a project and directory is not recorded by the Undo feature, therefore if you rename a file before this, it has no way of restoring just the filename, so it restores the entire file path.

As far as I can tell from testing, there is not way it can overwrite a file in another package if a project is created with the same name, package name and file name as the renamed project because it will get undone first. The worst case senario is the package and file on an undo is merged with a project of the same name.

The steps to recreate are easier:

1. Create any Java project with main class.
2. Rename the package.
3. Rename the project along with the folder.
4. Repeat #3 and #4 3 times.
5. With focus on renamed project, click Undo 3 times.

Results is recreation of project/package on disk for each rename.
Comment 8 Martin Balin 2015-09-17 11:15:53 UTC
Report from old NetBeans version. Due to code changes since it was reported likely not reproducible now. Feel free to reopen if happens in 8.0.2 or 8.1.