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 - Replacing string literals in java source causes IllegalArgumentException: Illegal values: from = -1; to = xxx
Summary: Replacing string literals in java source causes IllegalArgumentException: Ill...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Pavel Flaska
URL:
Keywords:
Depends on:
Blocks: 90451
  Show dependency tree
 
Reported: 2007-02-14 21:57 UTC by _ deva
Modified: 2007-02-15 13:04 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Test module to reproduce the bug (12.70 KB, application/octet-stream)
2007-02-14 22:02 UTC, _ deva
Details

Note You need to log in before you can comment on or make changes to this 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