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 188343

Summary: renaming a package (which has subpackages) removes all files within that base package
Product: platform Reporter: fillumina <fillumina>
Component: FilesystemsAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: normal CC: cordisvictor, dudy, jbecicka, jtulach, juhrik, miibx5, mmirilovic, mperezma, tboudreau
Priority: P2    
Version: 6.x   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: This is the result after renaming package root to nr in Files View
j1
j2
j3
j4

Description fillumina 2010-07-03 08:33:32 UTC
I have a hierarchy of packages like that:

package1 (the base package I want to rename)
+---package2
    +-file21
    +-file22
+---package3
    +-file31
    +-file32
+-file1
+-file2

If I use try to rename the base package from package1 into packageA all seems to work well except the file1 and file2 are removed. The files' history is screwed as well and there isn't any way to recover those files directly from the IDE.

To rename the base package I have used the right-click menu of the package seen in the Files view.
Comment 1 fillumina 2010-07-03 09:27:58 UTC
Workaround: rebuild a separate hierarchy with the base package renamed and than move files starting from the deepest packages in the hierarchy.
Comment 2 Vitezslav Stejskal 2010-07-09 09:01:59 UTC
This really seems to work strange. I was able to refactor-rename the package, but after the operation some files were missing in the subpackages. After switching to a browser and back to the IDE they magically reappeared again.
Comment 3 Jan Becicka 2010-09-24 08:49:03 UTC
I can reproduce the issue Vita mentioned above. Files really looks deleted, but they are not. It looks like Explorer is not properly refreshed (FS events not fired?). Explorer view gets fixed, when I switched to another application and back to IDE.
Comment 4 Jan Becicka 2010-10-01 06:32:02 UTC
*** Bug 179935 has been marked as a duplicate of this bug. ***
Comment 5 Jaroslav Tulach 2010-10-01 08:38:28 UTC
Works in Build from Sep 19, 2010.
Comment 6 Jaroslav Tulach 2010-10-01 09:48:56 UTC
Created attachment 102221 [details]
This is the result after renaming package root to nr in Files View

I've seen this immediately after I did the rename. I had no need to jump out and back to the IDE.
Comment 7 Jan Becicka 2010-11-11 14:33:34 UTC
Start the ide with clean userdir. Create project to have the same file structure as you can see on picture j1. Close all editors. collapse all packages in Projects View, but do not collapse Source Packages Node. Switch to files view, select folder "g" and rename it to "d". So far so good. See pict. j2. Switch to Projects View. The packages seems to be empty. Pict J3. Invoke Source | Scan for External Changes ... everything seems to be OK again. Pict J4
Comment 8 Jan Becicka 2010-11-11 14:34:31 UTC
Created attachment 102911 [details]
j1
Comment 9 Jan Becicka 2010-11-11 14:34:51 UTC
Created attachment 102912 [details]
j2
Comment 10 Jan Becicka 2010-11-11 14:35:12 UTC
Created attachment 102913 [details]
j3
Comment 11 Jan Becicka 2010-11-11 14:35:32 UTC
Created attachment 102914 [details]
j4
Comment 12 Jaroslav Tulach 2010-12-08 13:25:41 UTC
Things worked for me in 73d3ca400b0e. Anyway projects view and packages node is provided by (java) projects.
Comment 13 Jan Becicka 2010-12-08 14:50:36 UTC
Try it again. I can reproduce it on Linux and Mac. 
PackageViewChildren is implemented in java/project. But it listens on filesystem, which fires events when you invoke Scan for External changes. This change was not external. Changes should be fired immediately in this case.
Comment 14 Jaroslav Tulach 2010-12-08 15:40:42 UTC
Change are fired in all cases, there is no reason why they shall not be fired in this one. Make sure you are listening properly.
Comment 15 Jan Becicka 2010-12-08 15:45:44 UTC
I checked in in debugger. Events are fires after I do "scan for external changes"
Comment 16 Jan Becicka 2010-12-27 15:25:38 UTC
*** Bug 193271 has been marked as a duplicate of this bug. ***
Comment 17 Jan Becicka 2011-02-14 11:53:16 UTC
*** Bug 195396 has been marked as a duplicate of this bug. ***
Comment 18 Jan Becicka 2011-02-15 15:58:02 UTC
*** Bug 195509 has been marked as a duplicate of this bug. ***
Comment 19 Jaroslav Tulach 2011-02-16 12:11:06 UTC
Jan showed me how to simulate the problem. Yes, it does not work.
Comment 20 Jaroslav Tulach 2011-02-16 15:31:47 UTC
ergonomics#b23574afcce9
Comment 21 Jaroslav Tulach 2011-02-16 16:03:23 UTC
*** Bug 194765 has been marked as a duplicate of this bug. ***
Comment 22 Quality Engineering 2011-02-18 10:34:05 UTC
Integrated into 'main-golden', will be available in build *201102180501* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/b23574afcce9
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #188343: Always update FileNames from root to leafs. Also: Use in+out sets to speed the change up.
Comment 23 Jaroslav Tulach 2011-04-15 05:47:22 UTC
*** Bug 197550 has been marked as a duplicate of this bug. ***