Summary: | NPE renaming package | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | John Arthorne <john.arthorne> | ||||
Component: | Core | Assignee: | Jerome Lanneluc <jerome_lanneluc> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P2 | CC: | dirk_baeumer, eclipse | ||||
Version: | 3.1 | ||||||
Target Milestone: | 3.1 M5 | ||||||
Hardware: | PC | ||||||
OS: | Windows 2000 | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
John Arthorne
2005-01-25 14:42:09 EST
Created attachment 17431 [details]
Log file
The NPE happens in the Debug participant. Moving to Debug. The NPE appears when trying to rename a package to a sub-package of itself (test -> test.sub), if the package contains Java breakpoints. The Java Breakpoint participants rely on the fact than when perform() is called, the workspace is already in the new state (the 'after refactoring' state). But in this case, the state of the workspace doesn't look good. If the project was : Project Test + package test + compilation unit HW.java When the perform() method of the change is called, the project still looks the same. I would have excepted it to look like : Project Test + package test + package test.sub + compilation unit HW.java The consequense is project.findType("test.sub.HW") returns null, and an NPE is thrown when we try to use this value. It's only a problem when renaming to a sub package. It works fine in the other cases (test.sub1 -> tes2.subA, test.sub -> test). Moving to JDT/UI for comment. The refactoring calls IPackageFragment#rename("test.sub", false, pm); The renaming is executed correctly, but if I ask the package fragment root after the rename for its package I still get only "test" not "test" and "test.sub" (as Lus pointed out). Moving to JDT/Core for comments. The Java Model should reflect the changes in all cases. Luc, is it possible that Debug protects itself against the NPE. I all cases it is better to log this and do nothing instead of blowing up the refactoring. Changed JavaModelOperation#run(...) to close the parent element of the created element and to reset the corresponding project's cache. Added regresison test RenameTests#testRenamePF3() Verified in I20050214-0927 |