[CONJ-361] StringParameter class doesn't but should support (?) empty string Created: 2016-10-04  Updated: 2016-10-06  Resolved: 2016-10-06

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.5.3
Fix Version/s: 1.5.4

Type: Bug Priority: Critical
Reporter: Dan Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

With latest version 1.5.3 I came across this stacktrace

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
 
	at java.lang.String.charAt(String.java:658)
	at org.mariadb.jdbc.internal.packet.dao.parameters.StringParameter.escapeUtf8(StringParameter.java:197)
	at org.mariadb.jdbc.internal.packet.dao.parameters.StringParameter.writeTo(StringParameter.java:81)

The root cause seems to be that StringParameter doesn't handel empty strings, which I think it should.

Here is e simple test case:

final StringParameter stringParameter = new StringParameter("", false);
stringParameter.writeTo(new PacketOutputStream(new ByteArrayOutputStream(), false, 0));



 Comments   
Comment by Diego Dupin [ 2016-10-06 ]

Correction done is available in 1.5.4-SNAPSHOT.
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>1.5.4-SNAPSHOT</version>
</dependency>
</dependencies>

A correction release will be done soon, since this issue is critical.

Generated at Thu Feb 08 03:15:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.