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.
Summary: | Trying to replace constructor body results in StringIndexOutOfBoundsException: String index out of range: -1 | ||
---|---|---|---|
Product: | java | Reporter: | _ deva <deva> |
Component: | Source | Assignee: | Pavel Flaska <pflaska> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | sandipchitale |
Priority: | P2 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 90451 | ||
Attachments: | Test module project to reproduce the bug |
Description
_ deva
2007-01-31 22:42:25 UTC
Created attachment 37899 [details]
Test module project to reproduce the bug
Build and install the attached module and follow these steps to reproduce the bug 1) Open the file TestClass.java which is part of the project 2) Select Refactor|Replace Method Body You will see the StringIndexOutOfBoundsException. If you try again you do not see the exception. My reasoning below will explain why this is hapenning The new method tree obtained by TreeMaker.method() doesn't contain the synthetic statement super(), but in the code CasualDiff.diffBlock(), only the old block tree is checked for synthetic statement but both the old and new tree statements are advanced for comparison. Hence you will see the exception. When you try again second time, the old tree doesn't have synthetic statement and the replacement of body works fine. [Note that replaced code is not indented properly] Checking in src/org/netbeans/modules/java/source/save/CasualDiff.java; /cvs/java/source/src/org/netbeans/modules/java/source/save/CasualDiff.java,v <-- CasualDiff.java new revision: 1.63; previous revision: 1.62 done |