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 152885

Summary: IndexOutOfBoundsException: Invalid line index=57 >= lineCount=55
Product: db Reporter: Victoria Zhukovskaya <victoriaz>
Component: CodeAssignee: Jiri Skrivanek <jskrivanek>
Status: RESOLVED DUPLICATE    
Severity: blocker CC: diesil, feerthaus, joao_neto, tbarker9
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
URL: http://statistics.netbeans.org/exceptions/detail.do?id=31639
Issue Type: DEFECT Exception Reporter: 31639
Attachments: stacktrace
SQL file that produces issue

Description Victoria Zhukovskaya 2008-11-10 16:07:16 UTC
Build: NetBeans IDE 6.5 (Build 200811100001)
VM: Java HotSpot(TM) Client VM, 1.6.0_02-b06, Java(TM) SE Runtime Environment, 1.6.0_02-b06
OS: Windows XP, 5.1, x86

User Comments:
aldobrucale: click in a link in an sql output tab

aldobrucale: following a link in db output



Stacktrace: 
java.lang.IndexOutOfBoundsException: Invalid line index=57 >= lineCount=55
        at org.netbeans.editor.LineRootElement.getElement(LineRootElement.java:112)
        at org.openide.text.NbDocument$DocumentRenderer.run(NbDocument.java:669)
        at org.netbeans.editor.BaseDocument.render(BaseDocument.java:1362)
        at org.openide.text.NbDocument$DocumentRenderer.renderToInt(NbDocument.java:644)
        at org.openide.text.NbDocument.findLineOffset(NbDocument.java:176)
        at org.openide.text.DocumentLine$Set.offset(DocumentLine.java:1026)
Comment 1 Victoria Zhukovskaya 2008-11-10 16:07:29 UTC
Created attachment 73584 [details]
stacktrace
Comment 2 David Vancouvering 2008-11-10 19:47:18 UTC
I think what's happening here is you are executing SQL with an error in it that refers to a line number, but the line
number is wrong, so the hyperlink fails.

The line number comes from the database server, so if the server is sending us the wrong line number, there's not much
we can do here.

It would be great if you could tell us what database vendor you are using, and what version of their driver you are using.

If you can provide an example of a SQL statement that doesn't work, that would be awesome.

Anyway, even though we can't prevent the exception, what we can do is see if there is a way to report the error that
isn't just an exception report.
Comment 3 David Vancouvering 2008-11-10 19:54:00 UTC
Hm, I think I need to retract what I said before.  For example, if I execute this:

select a.actor_id,
 a.first_name,
 a.last_name,
 a.last_update,
from actor a

I get this:

Error code 1064, SQL state 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'from actor a LIMIT 20 OFFSET 0' at line 5
Line 1, column 1

Execution finished after 0 s, 1 error(s) occurred.

Notice that the server says "line 5" but the hyperlink says "Line 1, column 1".  So it does sound like *we're* the ones
generating the line number, and we're doing it wrong for some reason.

victoriaz: can you please provide the SQL that caused the error?  That would be really helpful.

I have tried various ways to get a bad line number but don't seem to have the right magic key to make it happen...
Comment 4 Jiri Rechtacek 2009-02-10 15:21:07 UTC
Reassigned to new owner.
Comment 5 soliver 2009-03-13 19:23:20 UTC
I just received this error, so here is some more info:
Product Version: NetBeans IDE 6.5 (Build 200811100001)
Java: 1.5.0_16; Java HotSpot(TM) Client VM 1.5.0_16-133
System: Mac OS X version 10.5.6 running on i386; MacRoman; en_US (nb)
Userdir: /Users/stevenoliver/.netbeans/6.5

I was using a MySQL database:
Server version: 6.0.9-alpha MySQL Community Server (GPL)
Comment 6 soliver 2009-03-13 19:25:18 UTC
Created attachment 78164 [details]
SQL file that produces issue
Comment 7 soliver 2009-03-13 19:40:06 UTC
Sorry, one more thing I forgot,

Database Connection Driver:
com.mysql.jdbc.Driver
Comment 8 Jiri Rechtacek 2009-07-01 07:43:55 UTC
NB6.7 was released already - http://www.netbeans.org/community/releases/67/
Postpone fixing this issue on the next release.
Comment 9 Jiri Skrivanek 2009-09-15 10:36:21 UTC
Caused by improper handling of line comments.

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