[CONJ-201] Prepared Statement with ? parameters after last ) causes string index out of bounds error Created: 2015-09-18 Updated: 2015-10-06 Resolved: 2015-10-06 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | Other |
| Affects Version/s: | 1.2.2 |
| Fix Version/s: | 1.2.3 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Matthew Madson | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
MySQL 5.6.22 Community Server |
||
| Issue Links: |
|
||||||||
| Description |
|
Sample Query:
Problem:
Throws the following exception:
The problem appears to be on line 83 of MySQLParameterizedQuery:
For the above query, the lastPart is an empty string and lastPart.indexOf(")") returns -1, thus lastPart.substring(0,-1) throws an exception. I'm not sure what you are trying to do here, so I can't provide a fix but it's definitely a blocker for me. |
| Comments |
| Comment by Sam Ottenhoff [ 2015-10-02 ] |
|
We just recently ran into this bug with the Sakai open-source learning management system. The " on duplicate key update " is a fairly common pattern: https://github.com/sakaiproject/sakai/search?utf8=%E2%9C%93&q=%22on+duplicate+key%22 Our stack trace: 2015-10-01 10:54:49,937 WARN http-bio-8080-exec-3 org.sakaiproject.content.impl.DbContentService - sql == insert into CONTENT_DROPBOX_CHANGES (DROPBOX_ID, IN_COLLECTION, LAST_UPDATE) values (? , ? , ?) on duplicate key update IN_COLLECTION = ?, LAST_UPDATE = ? |
| Comment by Diego Dupin [ 2015-10-05 ] |
|
similar problem |
| Comment by Diego Dupin [ 2015-10-05 ] |
|
This bug is corrected in 1.3.0 (in beta actually), but this cannot wait the release of the 1.3.0. |