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 225394

Summary: IndexOutOfBoundsException: start=-15 < 0
Product: editor Reporter: ecerichter
Component: Painting & PrintingAssignee: Miloslav Metelka <mmetelka>
Status: VERIFIED FIXED    
Severity: normal CC: apric, artur_m, bravo, Debeet, drazisil, Dredd, edjon2000, lehel, mmirilovic, mmolda, vriha, zeloras
Priority: P1    
Version: 7.3   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 197810
Attachments: stacktrace
stacktrace
stacktrace
stacktrace

Description ecerichter 2013-01-28 03:11:18 UTC
Build: NetBeans IDE Dev (Build nbms-and-javadoc-10056-on-20130112)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.6-b04, Java(TM) SE Runtime Environment, 1.7.0_11-b21
OS: Windows 7

User Comments:
GUEST: I removed the comment from the default PHP template by selecting from the bottom of the comment to the top and hitting 'delete'.

ecerichter: Cut imported class to move to another place.




Stacktrace: 
java.lang.IndexOutOfBoundsException: start=-15 < 0
   at org.netbeans.lib.editor.util.CharSequenceUtilities.checkIndexesValid(CharSequenceUtilities.java:529)
   at org.netbeans.modules.editor.lib2.document.CharContent.subSequence(CharContent.java:95)
   at org.netbeans.lib.lexer.token.DefaultToken.text(DefaultToken.java:142)
   at org.netbeans.lib.lexer.token.AbstractToken.dumpInfo(AbstractToken.java:251)
   at org.netbeans.lib.lexer.LexerUtilsConstants.appendTokenInfo(LexerUtilsConstants.java:431)
   at org.netbeans.lib.lexer.LexerUtilsConstants.appendTokenInfo(LexerUtilsConstants.java:410)
Comment 1 ecerichter 2013-01-28 03:11:20 UTC
Created attachment 130705 [details]
stacktrace
Comment 2 Milutin Kristofic 2013-01-29 11:46:46 UTC
Maybe 73_HR_FIX #218601 can cause this.
Comment 3 lehel 2013-02-11 10:43:45 UTC
Created attachment 131233 [details]
stacktrace

test of php project creating and running
Comment 4 Vladimir Riha 2013-02-20 09:16:56 UTC
Created attachment 131594 [details]
stacktrace

editing tag file, currently I was trying code completion for import in <%@ tag import>
Comment 5 drazisil 2013-03-20 13:06:08 UTC
 id #665964 may be helpful, I got stuck in an error loop and was nearly unable to get out.
Comment 6 Marian Mirilovic 2013-04-25 16:32:13 UTC
115 ERs in 3 months ... reproduced also in 7.3.1
looks like regression in recent Dev & ported together with some fix into reelase73 branch
Comment 7 mmolda 2013-04-26 13:28:22 UTC
Created attachment 133849 [details]
stacktrace

1. Created new php web page
2. select all code (Ctrl + A)
3. pressed delete

4. exception window shows up
Comment 8 Marian Mirilovic 2013-05-03 11:11:09 UTC
Mila, any chance to fix it into 7.3.1 ?
Comment 9 Miloslav Metelka 2013-05-06 14:48:31 UTC
(In reply to comment #2)
> Maybe 73_HR_FIX #218601 can cause this.

Issue #225451 which is integrated in release73 resolves #218601.
Comment 10 Miloslav Metelka 2013-05-06 15:42:04 UTC
It's certainly a race condition since unfortunately I can reproduce none of the reproduction steps described in users' reports.
So far I've found only one document-lock violation (that might affect the lexer) across php and it's PhpTypedTextInterceptor.afterInsert() but that one is not triggered in case of just selecting all the text and pressing delete. So there must be some other problem. I'll try to add some more asserts across lexer's code together with describing as much context as possible in order to find the problem.
Comment 11 Vladimir Riha 2013-05-07 09:10:23 UTC
I'm sorry, I can't find a way to reproduce it
Comment 12 Marian Mirilovic 2013-05-14 08:30:51 UTC
Mila, 
any progress ? I know it's difficult to fix bugs those we can't reproduce, but this one is rising pretty often and I that's the reason we need to address it in 7.3.1 I guess.
Comment 13 Miloslav Metelka 2013-05-21 14:02:35 UTC
*** Bug 224347 has been marked as a duplicate of this bug. ***
Comment 14 Miloslav Metelka 2013-05-21 14:06:41 UTC
Unfortunately I'm still not able to reproduce the problem.
Yesterday I've fixed issue #227419 but it will likely not eliminate this problem.
I'm working on some extra multi-threading tests for the lexer hoping to find the problem.
Comment 15 Miloslav Metelka 2013-05-22 14:56:36 UTC
I'm going to simplify the locking mechanism of the lexer in terms of issue #230125 but it will be a large fix that would be too risky for 7.3.1.

For 7.3.1 I've made a temporary fix to Token.text() that, in case of IOOBE, it logs the exception and returns an empty string.

http://hg.netbeans.org/jet-main/rev/367a0820acae
Comment 16 Quality Engineering 2013-05-26 02:23:47 UTC
Integrated into 'main-golden', will be available in build *201305252300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/367a0820acae
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #225394 - IndexOutOfBoundsException: start=-15 < 0 - temporary fix until lexer locking simplification gets implemented.
Comment 17 Miloslav Metelka 2013-05-26 16:53:03 UTC
In release73:
367a0820acae transplanted to eff3439c2d2f
Comment 18 Quality Engineering 2013-05-27 00:12:34 UTC
Integrated into 'releases', will be available in build *201305262200* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/eff3439c2d2f
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #225394 - IndexOutOfBoundsException: start=-15 < 0 - temporary fix until lexer locking simplification gets implemented.
(transplanted from 367a0820acae1b5b93aa4dd12d0d12a2470be55a)
Comment 19 Jiri Prox 2013-06-06 13:23:35 UTC
verified
Comment 20 Milutin Kristofic 2013-07-11 15:24:54 UTC
*** Bug 224771 has been marked as a duplicate of this bug. ***