Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-361

StringParameter class doesn't but should support (?) empty string

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.5.3
    • Fix Version/s: 1.5.4
    • Component/s: Other
    • 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));
      

        Attachments

          Activity

            People

            Assignee:
            diego dupin Diego Dupin
            Reporter:
            Dan Dan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration