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

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 2.6.0
    • 2.6.1
    • configuration
    • 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

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

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.