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.
Trying to replace string literals in a given class using visitor pattern results in java.lang.IllegalArgumentException CasualDiff.diffTree() method in certain cases computes the diff and adds it the list but doesn't change the return value which is initialized to -1 in the beginning. Sometimes return value of this explained method is used in CasualDiff.copyTo() which can result in IllegalArgumentException.
Created attachment 38512 [details] Test module 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 Strings You will notice IllegalArgumentException
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.61; previous revision: 1.60 done
And one test yet. Checking in unit/src/org/netbeans/api/java/source/gen/BodyStatementTest.java; /cvs/java/source/test/unit/src/org/netbeans/api/java/source/gen/BodyStatementTest.java,v <-- BodyStatementTest.java new revision: 1.20; previous revision: 1.19 done