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 207264 - IllegalArgumentException: len=-2 < 0
Summary: IllegalArgumentException: len=-2 < 0
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 7.2
Hardware: All All
: P1 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
: 206280 (view as bug list)
Depends on: 218053
Blocks:
  Show dependency tree
 
Reported: 2012-01-13 10:42 UTC by FrantaM
Modified: 2012-09-19 03:00 UTC (History)
11 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 183623


Attachments
stacktrace (3.66 KB, text/plain)
2012-01-13 10:42 UTC, FrantaM
Details
stacktrace (9.81 KB, text/plain)
2012-03-28 00:32 UTC, MackSix
Details
stacktrace (2.10 KB, text/plain)
2012-07-27 23:30 UTC, jyeary
Details
stacktrace (2.10 KB, text/plain)
2012-07-27 23:33 UTC, jyeary
Details
stacktrace (9.89 KB, text/plain)
2012-08-02 12:30 UTC, misterm
Details
stacktrace (2.10 KB, text/plain)
2012-08-03 11:48 UTC, jyeary
Details
Project to use for reproduction. (23.44 KB, application/zip)
2012-09-12 11:14 UTC, MackSix
Details
logfile (62.53 KB, text/plain)
2012-09-12 11:15 UTC, MackSix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description FrantaM 2012-01-13 10:42:03 UTC
Build: NetBeans IDE Dev (Build 201201080601)
VM: Java HotSpot(TM) 64-Bit Server VM, 22.0-b10, Java(TM) SE Runtime Environment, 1.7.0_02-b13
OS: Linux

User Comments:
GUEST: I was refactoring(renaming variables)

GUEST: refactoring Class




Stacktrace: 
java.lang.IllegalArgumentException: len=-2 < 0
   at org.netbeans.editor.BaseDocument.handleRemove(BaseDocument.java:903)
   at org.netbeans.editor.BaseDocument$FilterBypassImpl.remove(BaseDocument.java:2343)
   at javax.swing.text.DocumentFilter.remove(DocumentFilter.java:79)
   at org.openide.text.CloneableEditorSupport$DocFilter.remove(CloneableEditorSupport.java:2995)
   at org.netbeans.editor.BaseDocument.remove(BaseDocument.java:889)
   at org.netbeans.modules.spring.beans.completion.SpringXMLConfigCompletionItem$1.run(SpringXMLConfigCompletionItem.java:195)
Comment 1 FrantaM 2012-01-13 10:42:06 UTC
Created attachment 114864 [details]
stacktrace
Comment 2 Milutin Kristofic 2012-01-16 11:03:02 UTC
There are three types of stacktraces, all related to factoring.
Comment 3 Miloslav Metelka 2012-02-22 15:27:29 UTC
Invalid length of document removal.
Comment 4 Martin Fousek 2012-03-23 12:57:22 UTC
Spring's case should be fixed by web-main #b0f849f3dd78.
Comment 5 Quality Engineering 2012-03-24 10:58:33 UTC
Integrated into 'main-golden', will be available in build *201203240400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/b0f849f3dd78
User: Martin Fousek <marfous@netbeans.org>
Log: #207264 - IllegalArgumentException: len=-2 < 0
Comment 6 Quality Engineering 2012-03-25 09:43:11 UTC
Integrated into 'main-golden', will be available in build *201203250401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/b0f849f3dd78
User: Martin Fousek <marfous@netbeans.org>
Log: #207264 - IllegalArgumentException: len=-2 < 0
Comment 7 MackSix 2012-03-28 00:32:21 UTC
Created attachment 117368 [details]
stacktrace

Trying to multi-replace a variable name with a new name in a Java class file.
Comment 8 Martin Fousek 2012-03-28 04:16:46 UTC
Most reports are java.source related, reassigning further for evaluation of their cases.
Comment 9 MackSix 2012-03-28 05:16:00 UTC
Here is how to reproduce it:


1.) Open a Java file in NetBeans.
2.) Put cursor on a variable name.
3.) Press Ctrl+R then Ctrl+F then Ctrl+R again.
4.) Rename dialog appears. 
5.) Rename variable and push the Refactor button.

This Exception happens.
Comment 10 jyeary 2012-07-27 23:30:33 UTC
Created attachment 122480 [details]
stacktrace

Attempted to refactor a value using CTRL+R to rename it.
Comment 11 jyeary 2012-07-27 23:33:34 UTC
Created attachment 122481 [details]
stacktrace
Comment 12 misterm 2012-08-02 12:30:45 UTC
Created attachment 122676 [details]
stacktrace
Comment 13 Exceptions Reporter 2012-08-02 12:30:53 UTC
This bug already has 50 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=183623
Comment 14 misterm 2012-08-02 12:43:50 UTC
I was using Refactoring -> Change Method Parameters and changed both arguments order and the name of one of them when the exception was thrown.
Comment 15 jyeary 2012-08-03 11:48:45 UTC
Created attachment 122711 [details]
stacktrace

Failed to refactor the name of a variable. I was attempting to rename a variable using the CTRL + R reafactoring method.
Comment 16 Jan Lahoda 2012-09-10 09:02:06 UTC
I have separated the change method parameters test case:
http://netbeans.org/bugzilla/show_bug.cgi?id=218053

For the (Java) rename refactoring testcase, sorry, but there is not enough information to fix that. I have added some debugging logs:
http://hg.netbeans.org/jet-main/rev/e0d8ba9d5add
so when we have some messages.log with this data, it might be possible to find out what is wrong. But even better would be precise steps to reproduce. Thanks for your help.
Comment 17 Quality Engineering 2012-09-11 02:19:44 UTC
Integrated into 'main-golden', will be available in build *201209110001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/e0d8ba9d5add
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #207264: adding debugging logs - keep creation stack traces for a few committed ModificationResults, and print them if commit fails.
Comment 18 Jan Lahoda 2012-09-11 13:02:08 UTC
*** Bug 206280 has been marked as a duplicate of this bug. ***
Comment 19 MackSix 2012-09-12 11:14:20 UTC
Created attachment 124231 [details]
Project to use for reproduction.

Here is how to reproduce it:


1.) Open attached project in NetBeans.
2.) Open up WithInner.java file in newpackage1.
3.) On line 12, put cursor in front of variable name "p".
4.) Press Ctrl+R and inline red editing box surrounds variable name.
5.) Then press Ctrl+F and the Find toolbar appears with "p" in find field.
6.) Then press Ctrl+R again and the Rename Field dialog pops up with "p" in field. 
7.) Rename variable to p1 and push the Refactor button.
Comment 20 MackSix 2012-09-12 11:15:53 UTC
Created attachment 124232 [details]
logfile

See attached logfile.
Comment 21 Jan Lahoda 2012-09-18 13:22:50 UTC
Thanks for the testcase. It is an interaction between instant rename and full refactoring. Fix attempt:
http://hg.netbeans.org/jet-main/rev/08550ae09fdc
Comment 22 Quality Engineering 2012-09-19 03:00:09 UTC
Integrated into 'main-golden', will be available in build *201209190001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/08550ae09fdc
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #207264: must cancel instant rename when running full refactoring.