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

wrong Resultset.wasNull() for zero-date timestamps

    XMLWordPrintable

Details

    Description

      We updated mariadb-java client from version 2.72 to 3.1.2
      This seems to cause an jdbc compatibility problem as follows.

      There is a Timestamp 0,0,0 0,0,0:000 in the database. mariadb-java reads this value and converts this to null.
      See https://github.com/mariadb-corporation/mariadb-connector-j/blame/master/src/main/java/org/mariadb/jdbc/client/column/TimestampColumn.java

          // xpand workaround https://jira.mariadb.org/browse/XPT-274
          if (year == 0
              && month == 0
              && dayOfMonth == 0
              && hour == 0
              && minutes == 0
              && seconds == 0
              && microseconds == 0) return null;
      

      I dont know what the comment means, and the link doesnt work for me. However this behavior means that ResultSet#getTimestamp will return null, if the databse value is not NULL but 0,0,0 0,0,0:000.
      our codebase asumes that ResultSet#getTimespamp can only return null, if the Coloumn Value is SQL NULL (as checked with #wasNull). However in this case #wasNull will return false, yet the value will be null, causing a Nullpointer Exception in the process.
      I guess thats a jdbc compatibility violation?

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            Gösen Thorsten Goetzke
            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.