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 48653 - Rename of empty package broken in some cases
Summary: Rename of empty package broken in some cases
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks: 41535
  Show dependency tree
 
Reported: 2004-09-08 10:13 UTC by Milan Kubec
Modified: 2006-03-24 10:09 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 Milan Kubec 2004-09-08 10:13:50 UTC
[dev-20040907, JDK 1.5.0 RC]

1) Create empty package org.pkg in java
application project
2) Invoke Rename on that package and change the
name to: 'org.pkglibrary'
The result is 'org.pkg.ibrary'
3) Invoke Rename again and change the name again
to: 'org.pkglibrary'
The result is 'org.pkg'
Comment 1 Jesse Glick 2004-09-08 15:31:59 UTC
Reproducible for me. More simply, renaming "org.pkg" to "org.pakg"
works but renaming to "org.pkg2" does not.

I think PackageNode.setName is buggy. In particular, the calculation
of 'index' vs. 'i' looks suspicious. What happens if
name.startsWith(oldName) or vice versa? Need to expand the unit test
to include these border cases.
Comment 2 Tomas Zezula 2004-09-08 17:07:23 UTC
Sorry, thats my fault I forgot about this while writing the unit test.
I am going to extend the test and fix it.
Comment 3 Tomas Zezula 2004-09-08 19:39:17 UTC
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.java
new revision: 1.41; previous revision: 1.40
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.18; previous revision: 1.17
done
Comment 4 Tomas Zezula 2004-09-08 19:40:19 UTC
Fixed in trunk.
Comment 5 Milan Kubec 2004-09-09 09:46:07 UTC
Verified in trunk, custom 20040909.
Comment 6 Tomas Zezula 2004-09-13 14:46:06 UTC
Integrated into release40_beta2
Checking in
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.java
new revision: 1.39.4.2; previous revision: 1.39.4.1
Comment 7 Milan Kubec 2004-09-21 10:38:19 UTC
Verified in pre-beta2-200409210530.