Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 132989 - StringIndexOutOfBoundsException: String index out of range: 140
StringIndexOutOfBoundsException: String index out of range: 140
Status: VERIFIED FIXED
Product: db
Classification: Unclassified
Component: SQL Editor
6.x
All All
: P2 (vote)
: TBD
Assigned To: David Vancouvering
issues@db
http://statistics.netbeans.org/except...
EXCEPTIONS_REPORT, 61fixes1-fixed
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-04-16 12:48 UTC by Roman Mostyka
Modified: 2008-06-04 08:35 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments
stacktrace (1.02 KB, text/plain)
2008-04-16 12:48 UTC, Roman Mostyka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Mostyka 2008-04-16 12:48:03 UTC
Build: NetBeans IDE 6.1 RC1 (Build 200804100130)
VM: Java HotSpot(TM) Client VM, 10.0-b19, Java(TM) SE Runtime Environment, 1.6.0_05-b13
OS: Windows XP, 5.1, x86

User Comments: 
1. Add MySQL DB to an IDE (try jdbc:mysql://rave-db.russia.sun.com/travel or jdbc:mysql://jbrave-pc1.sfbay.sun.com/travel; login/password for both is 'travel').
2. Open SQL Editor and add following code:
delimiter ??
create procedure test() as
begin
set x = select count(*) from person;
if x == 2
  select * from trip;
end if;
end??
delimiter ;
3. Run query.

Result: StringIndexOutOfBoundsException arises.
Comment 1 Roman Mostyka 2008-04-16 12:48:07 UTC
Created attachment 60270 [details]
stacktrace
Comment 2 Roman Mostyka 2008-04-16 12:49:40 UTC
I set priority to P2 because I don't see any workaround. If there is some, please let me know and downgrade priority
back to P3.
Comment 3 David Vancouvering 2008-04-16 16:33:38 UTC
I was able to reproduce.  It's an off-by-one error in my parsing.

The workaround is to add an extra space after the last character in your command text.

Then your example fails with a syntax error.   I think I gave you this example, sorry.

Try

delimiter ??
create procedure test()
begin
declare x tinyint;
select count(*) from person into x;
if x = 2
then
  select * from trip;
end if;
end??
delimiter ; 

*with* the extra space at the end.

Actually, you don't need to say 'delimiter ;' at the end if you're not going to run any more SQL after declaring stored
proc.
Comment 4 David Vancouvering 2008-04-16 16:34:39 UTC
You can validate the stored proc is there by opening up the Procedures node for the connection...
Comment 5 David Vancouvering 2008-04-22 01:18:41 UTC
http://hg.netbeans.org/main?cmd=changeset;node=81cf7bae4006
Comment 6 Roman Mostyka 2008-04-22 15:04:45 UTC
Verified with trunk build 080422. Do push into patch1 branch.
Comment 7 pgebauer 2008-04-28 21:41:44 UTC
The fix has been ported into the release61_fixes branch:

http://hg.netbeans.org/release61_fixes/rev/9d5bff554439


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo