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 46510

Summary: A package and its source are deleted when I delete another package.
Product: java Reporter: vbrabant <vbrabant>
Component: ProjectAssignee: Petr Hrebejk <phrebejk>
Status: CLOSED DUPLICATE    
Severity: blocker CC: jglick
Priority: P1    
Version: 4.x   
Hardware: PC   
OS: Windows 95/98   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 41535    

Description vbrabant 2004-07-23 20:03:38 UTC
Tested with NB20040722 & JDK1.4.2_05
Steps to reproduce:

1. Create a new project.
2. Create a new package (org.netbeans.package1)
3. Create many class in that package (Class1,
Class2, Class3).
4. Create another package (org.netbeans.package2)
5. Right-click on that package and select delete.
6. Confirm his deletion
7. NB deletes package2 but also package1 and his
contents.
Comment 1 vbrabant 2004-07-23 20:06:15 UTC
It's the third time it happens.
The first time was with NB20040711.
The second time was with NB20040719.
And now. But this time, I have steps to reproduce.
Comment 2 Jesse Glick 2004-07-23 21:08:52 UTC
I just tried following Vincent's instructions exactly (using a
j2seproject, which he did not specify) and failed to reproduce any
problem. org.netbeans.package2 was deleted as expected, and
org.netbeans.package1 was left untouched. 040722, 1.4.2_04, Linux.
Maybe Windows-specific?

Vincent, if you have built NB dev sources on your computer, you might try

ant -f java/project/build.xml test

which ought to pass.

However the unit test is not really adequate; tests what happens when
the FileObject is deleted, but does not test PackageNode.destroy at all.

Also PackageNode.destroy()'s use of parent.isEmpty() when deleting
empty parent packages is certainly wrong, since isEmpty() will return
true if there are (empty) subpackages, meaning that if you have an
*empty* package org.netbeans.package1 and (an empty or nonempty)
org.netbeans.package2, and you delete package2, package1 will be
deleted as well, which is rather surprising and certainly a bug. Not
data loss, however - should not happen if there are any files in package1.
Comment 3 vbrabant 2004-07-23 22:50:44 UTC
I am sorry, but I confirm the issue.
Sorry Jesse. I am not building from source. I always download
Installer. Simpler for me.
And my packages were not empty.
Comment 4 Petr Hrebejk 2004-07-24 09:06:40 UTC

*** This issue has been marked as a duplicate of 46399 ***
Comment 5 Jesse Glick 2004-07-24 18:40:46 UTC
I filed issue #46524 for the relatively minor problem about deleting
empty siblings.
Comment 6 Jaromir Uhrik 2006-01-19 09:29:38 UTC
Duplicate. Verified->Closed.