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 121975 - RandomIllegalStateException exception makes editor unusable
Summary: RandomIllegalStateException exception makes editor unusable
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Lexer (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
: 123380 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-11-15 11:22 UTC by Tomasz Slota
Modified: 2008-02-12 10:33 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Slota 2007-11-15 11:22:57 UTC
I used the daily build of Nov 15, created a new tag file, deleted the content of a JSP-style comment and the exception popped-up. After that it was 
possible to input text until the IDE was restarted. I made 3 attempts to reproduce it without success.

java.lang.IllegalStateException: Removing at index=4 but real index is -1 (indexWasMinusOne=true).
Wishing to remove tokenList
ETL: <279,281> IHC=3688594
T[0]: <null-text> <279,281> TEXT[0] DefT, la=1, st=1000, IHC=2390731

but marked-for-remove tokenList is 
ETL: <330,335> IHC=16364639
T[0]: "IOOBE at index=0!!!" <330,331> TEXT[0] DefT, la=1, st=0, IHC=11594973
T[1]: "IOOBE at index=0!!!" <331,332> TAG_OPEN_SYMBOL[15] DefT, la=1, st=8000, IHC=9349037
T[2]: "IOOBE at index=0!!!" <332,334> TAG_OPEN[5] DefT, la=1, st=9000, IHC=10643788
T[3]: "IOOBE at index=0!!!" <334,335> TAG_CLOSE_SYMBOL[16] DefT, st=0, IHC=11479824

from tokenListList
TokenListList for text/x-jsp/text/html, joinSections, hasChildren
[0]: ETL: <99,101> IHC=3430137

    T[0]: "\n\n" <99,101> TEXT[0] DefT, la=1, st=1000, IHC=3813115
[1]: ETL: <173,175> IHC=14852212

    T[0]: "\n\n" <173,175> TEXT[0] DefT, la=1, st=1000, IHC=9717925
[2]: ETL: <249,250> IHC=2972911

    T[0]: "\n" <249,250> TEXT[0] DefT, la=1, st=1000, IHC=3181708
[3]: ETL: <279,281> IHC=5992907

    T[0]: "\n\n" <279,281> TEXT[0] DefT, la=1, st=1000, IHC=9163630
[4]: ETL: <330,335> IHC=16364639

    T[0]: "IOOBE at index=0!!!" <330,331> TEXT[0] DefT, la=1, st=0, IHC=11594973
    T[1]: "IOOBE at index=0!!!" <331,332> TAG_OPEN_SYMBOL[15] DefT, la=1, st=8000, IHC=9349037
    T[2]: "IOOBE at index=0!!!" <332,334> TAG_OPEN[5] DefT, la=1, st=9000, IHC=10643788
    T[3]: "IOOBE at index=0!!!" <334,335> TAG_CLOSE_SYMBOL[16] DefT, st=0, IHC=11479824
[5]: ETL: <345,350> IHC=15072483

    T[0]: "IOOBE at index=0!!!" <345,347> TAG_OPEN_SYMBOL[15] DefT, st=4000, IHC=4051301
    T[1]: "IOOBE at index=0!!!" <347,349> TAG_CLOSE[6] DefT, la=1, st=6000, IHC=8289429
    T[2]: "IOOBE at index=0!!!" <349,350> TAG_CLOSE_SYMBOL[16] DefT, st=0, IHC=2446310


Modification description:
TEXT REMOVED <283,328>:45 "-- any content can be specified here e.g.: --"


----------------- ORIGINAL TEXT -----------------
<%-- 
    Document   : tst
    Created on : Nov 15, 2007, 12:15:31 PM
    Author     : tomslot
--%>

<%@tag description="put the tag description here" pageEncoding="UTF-8"%>

<%-- The list of normal or fragment attributes can be specified here: --%>
<%@attribute name="message"%>

<%-- any content can be specified here e.g.: --%>
<h2>${message}</h2>

----------------- BEFORE-CARET TEXT -----------------
<%-- 
    Document   : tst
    Created on : Nov 15, 2007, 12:15:31 PM
    Author     : tomslot
--%>

<%@tag description="put the tag description here" pageEncoding="UTF-8"%>

<%-- The list of normal or fragment attributes can be specified here: --%>
<%@attribute name="message"%>

<%|<--CARET

	at org.netbeans.lib.lexer.TokenHierarchyUpdate$TLLInfo.markRemoved(TokenHierarchyUpdate.java:438)
	at org.netbeans.lib.lexer.TokenHierarchyUpdate.markRemovedEmbeddings(TokenHierarchyUpdate.java:279)
	at org.netbeans.lib.lexer.TokenHierarchyUpdate.processNonBoundsChange(TokenHierarchyUpdate.java:253)
	at org.netbeans.lib.lexer.TokenHierarchyUpdate.update(TokenHierarchyUpdate.java:140)
	at org.netbeans.lib.lexer.TokenHierarchyOperation.textModified(TokenHierarchyOperation.java:429)
	at org.netbeans.spi.lexer.TokenHierarchyControl.textModified(TokenHierarchyControl.java:99)
	at org.netbeans.lib.lexer.inc.DocumentInput.modified(DocumentInput.java:153)
	at org.netbeans.lib.lexer.inc.DocumentInput.removeUpdate(DocumentInput.java:144)
	at org.netbeans.lib.editor.util.swing.PriorityDocumentListenerList.removeUpdate(PriorityDocumentListenerList.java:85)
	at javax.swing.text.AbstractDocument.fireRemoveUpdate(AbstractDocument.java:242)
	at org.netbeans.editor.BaseDocument.fireRemoveUpdate(BaseDocument.java:1390)
	at org.netbeans.editor.BaseDocument.remove(BaseDocument.java:784)
	at org.netbeans.editor.BaseKit$DeleteCharAction.actionPerformed(BaseKit.java:1455)
	at org.netbeans.modules.web.core.syntax.JSPKit$JspDeleteCharAction.actionPerformed(JSPKit.java:411)
	at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:290)
	at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1576)
	at javax.swing.JComponent.processKeyBinding(JComponent.java:2763)
	at javax.swing.JComponent.processKeyBindings(JComponent.java:2798)
	at javax.swing.JComponent.processKeyEvent(JComponent.java:2726)
	at java.awt.Component.processEvent(Component.java:5331)
	at java.awt.Container.processEvent(Container.java:2010)
	at java.awt.Component.dispatchEventImpl(Component.java:4021)
	at java.awt.Container.dispatchEventImpl(Container.java:2068)
	at java.awt.Component.dispatchEvent(Component.java:3869)
	at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1810)
	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:672)
	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:920)
	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:798)
	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:636)
	at java.awt.Component.dispatchEventImpl(Component.java:3907)
	at java.awt.Container.dispatchEventImpl(Container.java:2068)
	at java.awt.Window.dispatchEventImpl(Window.java:1774)
	at java.awt.Component.dispatchEvent(Component.java:3869)
[catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Comment 1 Jan Becicka 2007-11-21 14:58:17 UTC
Milo, please evaluate. Thanks
Comment 2 Miloslav Metelka 2007-11-21 15:49:59 UTC
Since it occurs randomly and there are two token lists with the same boundaries in the exception there must be some sort
of race condition present.
I'm already working on a fix where I've gone through the places where the embedded token lists are being created and
made improvements of synchronization and some other improvements. I expect to commit today evening.
Comment 3 Miloslav Metelka 2007-11-22 16:17:36 UTC
Hopefully fixed. If you are still able to reproduce please reopen the issue and try to run with
-J-Dorg.netbeans.lib.lexer.TokenHierarchyUpdate.level=FINE so that we get more debugging info. Thanks.

Checking in lib/lexer/inc/RemovedTokenList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/inc/RemovedTokenList.java,v  <--  RemovedTokenList.java
new revision: 1.9; previous revision: 1.8
done
Checking in lib/lexer/inc/MutableTokenList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/inc/MutableTokenList.java,v  <--  MutableTokenList.java
new revision: 1.8; previous revision: 1.7
done
Checking in lib/lexer/inc/IncTokenList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/inc/IncTokenList.java,v  <--  IncTokenList.java
new revision: 1.18; previous revision: 1.17
done
Checking in lib/lexer/inc/FilterSnapshotTokenList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/inc/FilterSnapshotTokenList.java,v  <--  FilterSnapshotTokenList.java
new revision: 1.8; previous revision: 1.7
done
Checking in lib/lexer/inc/TokenListChange.java;
/cvs/lexer/src/org/netbeans/lib/lexer/inc/TokenListChange.java,v  <--  TokenListChange.java
new revision: 1.14; previous revision: 1.13
done
Checking in lib/lexer/inc/SnapshotTokenList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/inc/SnapshotTokenList.java,v  <--  SnapshotTokenList.java
new revision: 1.10; previous revision: 1.9
done
Checking in lib/lexer/inc/StandaloneTokenList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/inc/StandaloneTokenList.java,v  <--  StandaloneTokenList.java
new revision: 1.8; previous revision: 1.7
done
Checking in lib/lexer/EmbeddedTokenList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/EmbeddedTokenList.java,v  <--  EmbeddedTokenList.java
new revision: 1.23; previous revision: 1.22
done
Checking in lib/lexer/EmbeddingContainer.java;
/cvs/lexer/src/org/netbeans/lib/lexer/EmbeddingContainer.java,v  <--  EmbeddingContainer.java
new revision: 1.25; previous revision: 1.24
done
Checking in lib/lexer/TokenList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/TokenList.java,v  <--  TokenList.java
new revision: 1.9; previous revision: 1.8
done
Checking in lib/lexer/SubSequenceTokenList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/SubSequenceTokenList.java,v  <--  SubSequenceTokenList.java
new revision: 1.16; previous revision: 1.15
done
Checking in lib/lexer/TokenListList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/TokenListList.java,v  <--  TokenListList.java
new revision: 1.15; previous revision: 1.14
done
Checking in lib/lexer/TokenSequenceList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/TokenSequenceList.java,v  <--  TokenSequenceList.java
new revision: 1.9; previous revision: 1.8
done
Checking in lib/lexer/TokenHierarchyOperation.java;
/cvs/lexer/src/org/netbeans/lib/lexer/TokenHierarchyOperation.java,v  <--  TokenHierarchyOperation.java
new revision: 1.34; previous revision: 1.33
done
Checking in lib/lexer/batch/SkimTokenList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/batch/SkimTokenList.java,v  <--  SkimTokenList.java
new revision: 1.8; previous revision: 1.7
done
Checking in lib/lexer/batch/BatchTokenList.java;
/cvs/lexer/src/org/netbeans/lib/lexer/batch/BatchTokenList.java,v  <--  BatchTokenList.java
new revision: 1.12; previous revision: 1.11
done
Checking in api/lexer/TokenSequence.java;
/cvs/lexer/src/org/netbeans/api/lexer/TokenSequence.java,v  <--  TokenSequence.java
new revision: 1.22; previous revision: 1.21
done
Checking in api/lexer/TokenHierarchyEventType.java;
/cvs/lexer/src/org/netbeans/api/lexer/TokenHierarchyEventType.java,v  <--  TokenHierarchyEventType.java
new revision: 1.5; previous revision: 1.4
done
Checking in spi/lexer/TokenHierarchyControl.java;
/cvs/lexer/src/org/netbeans/spi/lexer/TokenHierarchyControl.java,v  <--  TokenHierarchyControl.java
new revision: 1.11; previous revision: 1.10
Comment 4 Miloslav Metelka 2008-02-12 10:33:04 UTC
*** Issue 123380 has been marked as a duplicate of this issue. ***