Menu

#68 Rename package incorrect

current_CVS_Version
open
5
2004-05-18
2004-05-18
No

RecoderPacakge.rename may fail due to
StringIndexOutOfBoundException due to the following
piece of code:

String newSubName = newName +
pw.getFullName().substring(packagename.length());

The code fails under the following conditions:

- A sub-package of p (say p.ps) has been renamed to
ps' (note the missing name prefix p -> the package has
basically been moved one level up).

- Later , p is to be renamed. p tries to rename all of
its subpackages accordingly (with the new qualified
name). However, the name of p.ps (now p') does not
contain the expected prefix p, so substring is out of
bounds.

There is currently no handling for renaming a package
and moving it at the same time as described above.

Possible remedy: packages may only be renamed with an
unqualified name. Otherwise, "move" should be used.

Discussion


Log in to post a comment.