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 95614

Summary: Replacing string literals in java source causes IllegalArgumentException: Illegal values: from = -1; to = xxx
Product: java Reporter: _ deva <deva>
Component: SourceAssignee: 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 to reproduce the bug

Description _ deva 2007-02-14 21:57:38 UTC
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.
Comment 1 _ deva 2007-02-14 22:02:32 UTC
Created attachment 38512 [details]
Test module to reproduce the bug
Comment 2 _ deva 2007-02-14 22:03:15 UTC
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
Comment 3 Pavel Flaska 2007-02-15 13:00:14 UTC
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
Comment 4 Pavel Flaska 2007-02-15 13:04:33 UTC
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