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 159282 - IndexOutOfBoundsException: index=-1 < 0
Summary: IndexOutOfBoundsException: index=-1 < 0
Status: CLOSED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Tomasz Slota
URL: http://statistics.netbeans.org/except...
Keywords:
: 159884 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-02-27 07:32 UTC by patchinko
Modified: 2009-10-25 21:57 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 144897


Attachments
stacktrace (2.67 KB, text/plain)
2009-02-27 07:32 UTC, patchinko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description patchinko 2009-02-27 07:32:12 UTC
Build: NetBeans IDE Dev (Build 200902261558)
VM: Java HotSpot(TM) Client VM, 1.5.0_16-133, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_16-b06-284
OS: Mac OS X, 10.5.6, i386

User Comments:
patchinko: just editing a file

GUEST: I'm sorry It was in PHP source :/ 
here it is the code:
/*
echo $_SESSION['koszyk']['x'].";";
echo $_SESSION['koszyk']['y'];
*/
set current posiition to the last line and then start to go up(by arraow) holding shift button, to select text Exception occurs many each time i do that

ingoreinhart: If want to change a comment from
/*
*
*/

to

/**
*
*/

I get this error. Every time.

GUEST: I was marking text pushing up arraow ( on keyboard)  It was multiline comment in Javascript source file.



Stacktrace: 
java.lang.IndexOutOfBoundsException: index=-1 < 0
        at org.netbeans.lib.editor.util.CharSequenceUtilities.checkIndexNonNegative(CharSequenceUtilities.java:500)
        at org.netbeans.lib.editor.util.CharSequenceUtilities.checkIndexValid(CharSequenceUtilities.java:509)
        at org.netbeans.lib.lexer.token.DefaultToken$InputSourceSubsequence.charAt(DefaultToken.java:243)
        at org.netbeans.modules.php.editor.CompletionContextFinder.getCompletionContextInComment(CompletionContextFinder.java:582)
        at org.netbeans.modules.php.editor.CompletionContextFinder.findCompletionContext(CompletionContextFinder.java:223)
        at org.netbeans.modules.php.editor.PHPCodeTemplateFilter.run(PHPCodeTemplateFilter.java:102)
Comment 1 patchinko 2009-02-27 07:32:17 UTC
Created attachment 77444 [details]
stacktrace
Comment 2 Vitezslav Stejskal 2009-02-27 11:36:30 UTC
Most likely somewhere around
org.netbeans.modules.php.editor.CompletionContextFinder.getCompletionContextInComment(CompletionContextFinder.java:582).
Comment 3 Exceptions Reporter 2009-03-06 14:10:39 UTC
This issue has already 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=144897
Comment 4 Tomasz Slota 2009-03-19 17:42:06 UTC
Raising priority to P2 because of the duplicates, can't properly evaluate this issue as current web-main sources are unusable
Comment 5 Tomasz Slota 2009-03-20 14:45:21 UTC
Managed to reproduce it (not so easy, it is random). Current stack trace looks like this

java.lang.IndexOutOfBoundsException: index=-1 < 0
	at org.netbeans.lib.editor.util.CharSequenceUtilities.checkIndexNonNegative(CharSequenceUtilities.java:500)
	at org.netbeans.lib.editor.util.CharSequenceUtilities.checkIndexValid(CharSequenceUtilities.java:509)
	at org.netbeans.lib.lexer.token.DefaultToken$InputSourceSubsequence.charAt(DefaultToken.java:243)
	at org.netbeans.modules.php.editor.CompletionContextFinder.getCompletionContextInComment(CompletionContextFinder.java:583)
	at org.netbeans.modules.php.editor.CompletionContextFinder.findCompletionContext(CompletionContextFinder.java:224)
	at org.netbeans.modules.php.editor.PHPCodeTemplateFilter.run(PHPCodeTemplateFilter.java:95)
	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:128)
	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:112)
	at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:188)
Caused: org.netbeans.modules.parsing.spi.ParseException
	at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:190)
	at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:98)
	at org.netbeans.modules.php.editor.PHPCodeTemplateFilter.<init>(PHPCodeTemplateFilter.java:70)
	at org.netbeans.modules.php.editor.PHPCodeTemplateFilter$Factory.createFilter(PHPCodeTemplateFilter.java:112)
	at org.netbeans.lib.editor.codetemplates.CodeTemplateManagerOperation.getTemplateFilters(CodeTemplateManagerOperation.java:226)
	at org.netbeans.lib.editor.codetemplates.SurroundWithFix.getFixes(SurroundWithFix.java:71)
	at org.netbeans.lib.editor.codetemplates.AbbrevDetection.showSurroundWithHint(AbbrevDetection.java:424)
	at org.netbeans.lib.editor.codetemplates.AbbrevDetection.access$100(AbbrevDetection.java:93)
	at org.netbeans.lib.editor.codetemplates.AbbrevDetection$1.actionPerformed(AbbrevDetection.java:186)
	at javax.swing.Timer.fireActionPerformed(Timer.java:271)
[catch] at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
Comment 6 bartdeslagmulder 2009-03-20 14:57:36 UTC
I can tell you that I use this 6.7 dev version every day @ work. I have the same installed at home and never had this
problem there. (desktop: Linux (Ubuntu); Netbook: WinXP (Home))

@work I leave my comp running 5/7d 24/24h.

At the moment it consumes 307MB when I view it in Windows Task Manager.
Comment 7 Tomasz Slota 2009-03-20 15:00:36 UTC
Fixed

http://hg.netbeans.org/web-main/rev/155eecca13f7
Comment 8 Quality Engineering 2009-03-21 08:37:24 UTC
Integrated into 'main-golden', will be available in build *200903210201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/155eecca13f7
User: Tomasz Slota <tslota@netbeans.org>
Log: #159282: IndexOutOfBoundsException: index=-1 < 0
Comment 9 Filip Zamboj 2009-04-20 17:14:41 UTC
verified on 
Product Version: NetBeans IDE 6.7 Beta (Build 200904192254)
Java: 1.6.0_13; Java HotSpot(TM) 64-Bit Server VM 11.3-b02
Comment 10 Tomasz Slota 2009-05-19 10:04:08 UTC
*** Issue 159884 has been marked as a duplicate of this issue. ***
Comment 11 ingoreinhart 2009-10-25 21:57:17 UTC
restest with 200910241428 => ALL OK

Many thanks to the dev team!