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 132615 - IllegalStateException: Region: <6526,6526) not found.
Summary: IllegalStateException: Region: <6526,6526) not found.
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Miloslav Metelka
URL: http://statistics.netbeans.org/except...
Keywords: API
: 137843 150130 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-04-11 12:54 UTC by Petr Dvorak
Modified: 2009-10-26 15:12 UTC (History)
10 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 45925


Attachments
Source file (note: Jelly Test) (4.62 KB, text/plain)
2008-04-11 16:04 UTC, Petr Dvorak
Details
stacktrace (3.86 KB, text/plain)
2008-05-28 11:53 UTC, Tomas Danek
Details
stacktrace (3.51 KB, text/plain)
2008-08-11 16:24 UTC, Tomas Danek
Details
stacktrace (4.03 KB, text/plain)
2008-09-05 15:13 UTC, ulfzibis
Details
How it looks in editor, while IDE hangs (3.77 KB, image/jpeg)
2008-09-05 15:33 UTC, ulfzibis
Details
stacktrace (3.52 KB, text/plain)
2009-01-14 19:44 UTC, misterm
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Dvorak 2008-04-11 12:54:34 UTC
Build: NetBeans IDE Dev (Build 200804110003)
VM: Java HotSpot(TM) Client VM, 10.0-b19, Java(TM) SE Runtime Environment, 1.6.0_05-b12
OS: Linux, 2.6.22-14-generic, i386

User comments: I have selected an item from the editor hints and confirmed it with Enter

Editor became totally unusable after this exception - the caret was not synchronized with the typed text. I had to
restart NB.

STACKTRACE: (first 10 lines)
java.lang.IllegalStateException: Region: <6526,6526) not found.
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionManager.findRegionIndex(TextRegionManager.java:502)
        at
org.netbeans.lib.editor.codetemplates.textsync.TextRegionManager.removeRegionFromParent(TextRegionManager.java:575)
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionManager.removeTextSyncGroup(TextRegionManager.java:175)
        at org.netbeans.lib.editor.codetemplates.CodeTemplateInsertHandler.release(CodeTemplateInsertHandler.java:438)
        at org.netbeans.lib.editor.codetemplates.CodeTemplateInsertHandler.released(CodeTemplateInsertHandler.java:452)
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionEditing.releaseActiveGroup(TextRegionEditing.java:271)
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionEditing.stopSyncEditing(TextRegionEditing.java:296)
        at
org.netbeans.lib.editor.codetemplates.textsync.TextRegionEditing.docActiveTextSyncReleased(TextRegionEditing.java:264)
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionEditing$2.outsideModified(TextRegionEditing.java:234)
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionManager.outsideModified(TextRegionManager.java:327)
Comment 1 Jiri Prox 2008-04-11 14:11:30 UTC
Can you provide the source file, please?
Comment 2 Petr Dvorak 2008-04-11 16:02:41 UTC
Well, Jirka, sure I can, however - as I said - I have restarted NB and completed the unfinished line:o(.

The file is attached bellow, I got the exception while I used the auto completion in following section ('|' stands for
caret as usual):

          new Action(MENU_SWITCH2FLOW, null).perform();
          sleep(5000);
          ComponentPaletteOperator cpo = new ComponentPaletteOperator();
          cpo.|expand(new JCheckBoxOperator(cpo,NEW_CATEGORY), true);
Comment 3 Petr Dvorak 2008-04-11 16:04:19 UTC
Created attachment 60056 [details]
Source file (note: Jelly Test)
Comment 4 Exceptions Reporter 2008-05-20 15:40:07 UTC
This issue has already 5 duplicates 
Comment 5 Tomas Danek 2008-05-28 11:53:40 UTC
Created attachment 62053 [details]
stacktrace
Comment 6 Exceptions Reporter 2008-06-21 19:15:56 UTC
This issue has already 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=45925
Comment 7 Dusan Balek 2008-06-23 14:00:44 UTC
*** Issue 137843 has been marked as a duplicate of this issue. ***
Comment 8 Dusan Balek 2008-06-23 14:02:44 UTC
*** Issue 137843 has been marked as a duplicate of this issue. ***
Comment 9 Exceptions Reporter 2008-07-09 19:08:30 UTC
This issue has already 20 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=45925
Comment 10 Tomas Danek 2008-08-11 16:24:07 UTC
Build: NetBeans IDE 6.5 Beta (Build 200808101001)
VM: Java HotSpot(TM) Client VM, 11.0-b11, Java(TM) SE Runtime Environment, 1.6.0_10-beta-b14
OS: Linux, 2.6.24-19-generic, i386

User Comments: 
editing template for (int i=0l i< arr.lenght  -----> tried to change to my custom for loop

Stacktrace: 
java.lang.IllegalStateException: Region: <1666,1667) not found.
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionManager.findRegionIndex(TextRegionManager.java:502)
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionManager.fixRegionStartOffset(TextRegionManager.java:400)
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionManager.insertUpdate(TextRegionManager.java:238)
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionManager$DocListener.insertUpdate(TextRegionManager.java:622)
        at org.netbeans.editor.BaseDocument.insertString(BaseDocument.java:801)
        at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:655)
Comment 11 Tomas Danek 2008-08-11 16:24:11 UTC
Created attachment 67029 [details]
stacktrace
Comment 12 Miloslav Metelka 2008-08-26 14:38:02 UTC
Unfortunately I'm unable to reproduce from the steps given by joshis and musilt2. Could you please provide me more
detailed info of what you've been doing? Thanks.
Comment 13 Vitezslav Stejskal 2008-09-05 14:46:27 UTC
I think I can reproduce it:

1. open a java file that has a method in it
2. write System.out.println("") in the method
3. select this line
4. alt+enter to show available hints and choose 'Surrond with for(int i=...' hint
5. undo
6. repeat #3 and #4 and you should get the exception

IMO the problem is that when a user undoes a change, which resulted in creating synced-text regions, these regions are
not canceled properly. Maybe this is actually the same problem as issue #146105.
Comment 14 ulfzibis 2008-09-05 15:13:46 UTC
Build: NetBeans IDE Dev (Build 200809031401)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-rc-b28
OS: Windows XP, 5.1, x86

User Comments: 
"Backspace" on 6 marked text characters in Editor

Stacktrace: 
java.lang.IllegalStateException: Region: <5602,5625) not found.
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionManager.findRegionIndex(TextRegionManager.java:502)
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionManager.removeRegionFromParent(TextRegionManager.java:575)
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionManager.removeTextSyncGroup(TextRegionManager.java:175)
        at org.netbeans.lib.editor.codetemplates.CodeTemplateInsertHandler.release(CodeTemplateInsertHandler.java:438)
        at org.netbeans.lib.editor.codetemplates.CodeTemplateInsertHandler.released(CodeTemplateInsertHandler.java:452)
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionEditing.releaseActiveGroup(TextRegionEditing.java:274)
Comment 15 ulfzibis 2008-09-05 15:13:56 UTC
Created attachment 69159 [details]
stacktrace
Comment 16 ulfzibis 2008-09-05 15:31:36 UTC
- repeated "Backspace" on 6 marked text characters in Editor
- did 1..3 other small editings
- "Save All"
--> IDE completely hangs; had to exit IDE
Comment 17 ulfzibis 2008-09-05 15:33:11 UTC
Created attachment 69160 [details]
How it looks in editor, while IDE hangs
Comment 18 Miloslav Metelka 2008-09-09 14:48:23 UTC
I have finally decided to fix this by having a custom undoable edit marking a code template's insertion so there's a new
method in BaseDocument callable during document's atomic lock:

    public void addUndoableEdit(UndoableEdit edit);

Undoing the edit cancels CT's editing.

http://hg.netbeans.org/main/rev/56654571e1ce
Comment 19 Exceptions Reporter 2008-10-15 13:29:41 UTC
Reopening - reproduced in NetBeans IDE Dev (Build 200810150101)
http://statistics.netbeans.org/exceptions/detail.do?id=128182
Comment 20 Miloslav Metelka 2008-10-15 15:28:02 UTC
A different stacktrace - the new one is reported as issue 150130.
Comment 21 Exceptions Reporter 2008-11-04 17:05:33 UTC
Reopening - reproduced in NetBeans IDE Dev (Build 200811011401)
http://statistics.netbeans.org/exceptions/detail.do?id=135996
Comment 22 Miloslav Metelka 2008-11-10 16:56:05 UTC
Not sure why it happens. I have added a better exception's info.
http://hg.netbeans.org/main/rev/e71f217ccdc5
Comment 23 Quality Engineering 2008-11-11 05:04:18 UTC
Integrated into 'main-golden', will be available in build *200811110201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/e71f217ccdc5
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #132615 - IllegalStateException: Region: <6526,6526) not found. - better exception's info.
Comment 24 misterm 2009-01-14 19:44:50 UTC
Build: NetBeans IDE 6.5 (Build 200811100001)
VM: Java HotSpot(TM) Client VM, 10.0-b19, Java(TM) SE Runtime Environment, 1.6.0_04-b12
OS: Windows XP, 5.1, x86

User Comments: 
Error while typing a character (i) when code completion was showing for forc macro (in it variable)

Stacktrace: 
java.lang.IllegalStateException: Region: <20681,20682) not found.
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionManager.findRegionIndex(TextRegionManager.java:513)
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionManager.fixRegionStartOffset(TextRegionManager.java:411)
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionManager.insertUpdate(TextRegionManager.java:249)
        at org.netbeans.lib.editor.codetemplates.textsync.TextRegionManager$DocListener.insertUpdate(TextRegionManager.java:633)
        at org.netbeans.editor.BaseDocument.insertString(BaseDocument.java:802)
        at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:655)
Comment 25 misterm 2009-01-14 19:44:55 UTC
Created attachment 75838 [details]
stacktrace
Comment 26 Jiri Prox 2009-01-15 10:17:47 UTC
reproducible
Comment 27 Miloslav Metelka 2009-02-03 08:12:14 UTC
Should finally be fixed
http://hg.netbeans.org/main/rev/992aee21152c
Comment 28 Quality Engineering 2009-02-03 20:50:41 UTC
Integrated into 'main-golden', will be available in build *200902031446* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/992aee21152c
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #132615 - Code Templates: IllegalStateException: Region: <6526,6526) not found.
Comment 29 martinhavle 2009-04-03 13:04:21 UTC
Seems to be fixed properly, changing the state to VERIFIED.
Comment 30 Miloslav Metelka 2009-10-26 15:12:35 UTC
*** Issue 150130 has been marked as a duplicate of this issue. ***