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 46524

Summary: Empty sibling packages deleted when deleting package
Product: java Reporter: Jesse Glick <jglick>
Component: ProjectAssignee: Petr Hrebejk <phrebejk>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P2    
Version: 4.x   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 41535    

Description Jesse Glick 2004-07-24 18:39:57 UTC
Originally mentioned in issue #46510. Create an
empty j2seproject and packages "a.b" and "a.c".
Delete a.b. a.c is removed as well, which doesn't
make any sense. (a.c is not removed if there are
any files in it.)

Problem is in misuse of isEmpty to determine
whether to delete the next parent package in
PackageNode.destroy; should only delete the parent
if it is really empty, i.e. getChildren().length == 0.

Also PackageViewTest does not cover
PackageNode.destroy at all, which is a serious
omission.
Comment 1 Milan Kubec 2004-07-26 08:20:16 UTC
IMO this bug should be fixed to promo-D. It's really serious
misbehavior when deleting one package deletes also another (sibling)
package even when it's empty.
Comment 2 Petr Hrebejk 2004-07-27 10:13:49 UTC
Should be fixed. (not (ab)using isEmpty() ) Testcase added.

Checking in
project/src/org/netbeans/spi/java/project/support/ui/PackageViewChildren.java;
/cvs/java/project/src/org/netbeans/spi/java/project/support/ui/PackageViewChildren.java,v
 <--  PackageViewChildren.javanew revision: 1.22; previous revision: 1.21
done
Processing log script arguments...
More commits to come...
Checking in
project/test/unit/src/org/netbeans/spi/java/project/support/ui/PackageViewTest.java;
/cvs/java/project/test/unit/src/org/netbeans/spi/java/project/support/ui/PackageViewTest.java,v
 <--  PackageViewTest.java
new revision: 1.8; previous revision: 1.7
done
Comment 3 Jesse Glick 2004-07-30 21:10:34 UTC
*** Issue 46799 has been marked as a duplicate of this issue. ***
Comment 4 _ ttran 2004-07-31 12:55:28 UTC
*** Issue 46799 has been marked as a duplicate of this issue. ***