Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 132989 - StringIndexOutOfBoundsException: String index out of range: 140
StringIndexOutOfBoundsException: String index out of range: 140
Product: db
Classification: Unclassified
Component: SQL Editor
All All
: P2 (vote)
Assigned To: David Vancouvering
EXCEPTIONS_REPORT, 61fixes1-fixed
Depends on:
  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

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

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:// or jdbc:mysql://; login/password for both is 'travel').
2. Open SQL Editor and add following code:
delimiter ??
create procedure test() as
set x = select count(*) from person;
if x == 2
  select * from trip;
end if;
delimiter ;
3. Run query.

Result: StringIndexOutOfBoundsException arises.
Comment 1 Roman Mostyka 2008-04-16 12:48:07 UTC
Created attachment 60270 [details]
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.


delimiter ??
create procedure test()
declare x tinyint;
select count(*) from person into x;
if x = 2
  select * from trip;
end if;
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
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;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:

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