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 32658 - index out of bounds index=-2 must be >= 0
Summary: index out of bounds index=-2 must be >= 0
Status: RESOLVED DUPLICATE of bug 26549
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-06 17:59 UTC by ltyson
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (36.54 KB, text/plain)
2003-04-06 18:00 UTC, ltyson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ltyson 2003-04-06 17:59:11 UTC
java.lang.IndexOutOfBoundsException: Line 
index=-2 must be >= 0
        at 
org.netbeans.editor.BaseDocument$LineRootElemen
t.getElement(BaseDocument.java:1139)
        at 
org.openide.text.NbDocument.findLineOffset
(NbDocument.java:127)
        at 
org.openide.text.DocumentLine$Set.getCurrent
(DocumentLine.java:754)
        at 
org.netbeans.modules.java.parser.ParserAnnotati
on.attachToLineSet(ParserAnnotation.java:133)
        at 
org.netbeans.modules.java.JavaEditor.processAnn
otations(JavaEditor.java:452)
        at 
org.netbeans.modules.java.JavaEditor.access$400
(JavaEditor.java:80)
[catch] at 
org.netbeans.modules.java.JavaEditor$2.run
(JavaEditor.java:230)
        at 
java.awt.event.InvocationEvent.dispatch
(InvocationEvent.java:149)
        at java.awt.EventQueue.dispatchEvent
(EventQueue.java:332)
        at 
java.awt.EventDispatchThread.pumpOneEventForHie
rarchy(EventDispatchThread.java:126)
        at 
java.awt.EventDispatchThread.pumpEventsForHiera
rchy(EventDispatchThread.java:93)
        at 
java.awt.EventDispatchThread.pumpEvents
(EventDispatchThread.java:88)
        at java.awt.EventDispatchThread.run
(EventDispatchThread.java:80)
Comment 1 ltyson 2003-04-06 18:00:54 UTC
Created attachment 9723 [details]
IDE log
Comment 2 Miloslav Metelka 2003-04-08 14:28:52 UTC
It appears that getElement(-2) gets called on line root element.
I've tried to find out what's the culprit but it appears that
getCurret() in DocumentLine accepts even a negative line value so it's
necessary to search in ParserAnnotation. I have
        docline=lines.getCurrent(line-1);
on the line from the exception (not sure whether it's up-to-date or
not) so in theory it's possible to get a negative value although the
original value still had to be -1.
 I should note that I've changed BaseDocument's line root element's
getElement() method to throw IOOBE to adhere to
javax.swing.text.AbstractDocument functionality so it might be the
reason why this exception did not appear in the past.
Comment 3 Tomas Hurka 2003-04-08 16:35:01 UTC

*** This issue has been marked as a duplicate of 26549 ***