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

Null Pointer Exception when attempting to close an invalid connection

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6.0
    • Fix Version/s: 2.6.1
    • Component/s: configuration
    • Labels:
    • Environment:
      Red Hat Enterprise Linux release 8.1 (Ootpa)
      mysql Ver 15.1 Distrib 10.3.17-MariaDB, for Linux (x86_64) using readline 5.1
      openjdk version "1.8.0_222"

      Description

      I'm in the process of upgrading from MariaDB 5.5.56 to 10.3.17. As part of this I went from using mysql-connector-java version 5.1.35 to using mariadb-connector-java version 2.6.0. One of my java applications is now crashing at start up (the others are working with this setup). I've attached a stack trace and an approximate version of what my code is doing.

      Looking at the mariaDB Connector/J code I see that AbstractConnectProtocol is calling SendClosePacket.send with a null PacketOutputStream. I'm not sure where the exact problem is but I think MariaDB Connector should at least be throwing a better exception.

      if (!connection.isValid(0)) {
        connection.getConnection().close(); // exception happens here
      }
      

        [ERROR] java.lang.NullPointerException
        [ERROR]         at org.mariadb.jdbc.internal.com.send.SendClosePacket.send(SendClosePacket.java:68)
        [ERROR]         at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.close(AbstractConnectProtocol.java:382)
        [ERROR]         at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.closeExplicit(AbstractQueryProtocol.java:1384)
        [ERROR]         at org.mariadb.jdbc.MariaDbConnection.close(MariaDbConnection.java:777)
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: