Details
-
Bug
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
-
1.2.2
-
None
-
MySQL 5.6.22 Community Server
Win64 x86_64
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
Description
Sample Query:
insert into `SOME_TABLE` (`ID`, `FOO`, `BAR`, `BAZ`) values (?, ?, ?) on duplicate key update `SOME_TABLE`.`FOO` = ?, `SOME_TABLE`.`BAR` = ?, `SOME_TABLE`.`BAZ` = ? |
Problem:
connection.prepareStatement(sql);
|
Throws the following exception:
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
|
at java.lang.String.substring(Unknown Source)
|
at org.mariadb.jdbc.internal.common.query.MySQLParameterizedQuery.<init>(MySQLParameterizedQuery.java:83)
|
at org.mariadb.jdbc.MySQLPreparedStatement.<init>(MySQLPreparedStatement.java:90)
|
at org.mariadb.jdbc.MySQLConnection.prepareStatement(MySQLConnection.java:181)
|
...
|
The problem appears to be on line 83 of MySQLParameterizedQuery:
rewriteRepeatLastPart = lastPart.substring(0, lastPart.indexOf(")")).getBytes("UTF-8"); |
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.
Attachments
Issue Links
- relates to
-
CONJ-200 java.lang.StringIndexOutOfBoundsException: String index out of range: -1
- Closed