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

NullPointerException when executeBatch is called, and batch list is empty

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1.4
    • Component/s: None
    • Labels:
      None

      Description

      This simple part of code demonstrates the NullPointerException in the current code of the MariaDB driver (v1.1.3):

      try {
      Class.forName("org.mariadb.jdbc.Driver");
      String dbUrl = "jdbc:mysql://host:3306/db";
      Connection con = DriverManager.getConnection(dbUrl, "user", "pwd");
      Statement stmt = con.createStatement();
      // do not add any batch entries!
      stmt.executeBatch(); // -> NullPointerException
      con.close();
      }
      catch(Exception ex) {
      ex.printStackTrace();
      }
      
      

      Result:
      java.lang.NullPointerException
      at org.mariadb.jdbc.MySQLStatement.executeBatch(MySQLStatement.java:1121)

      This NullPointerException is raised when the executeBatch is called with no batches added.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            anchung Lance Man added a comment -

            We encountered the same issue for the PreparedStatement/CallableStatement cases. In the MySQLPreparedStatement.class, it overrides the executeBatch() of MySQLStatement.class but no super() was called. NPE was thrown based on the same situation. Do you consider to fix it as well?

            Show
            anchung Lance Man added a comment - We encountered the same issue for the PreparedStatement/CallableStatement cases. In the MySQLPreparedStatement.class, it overrides the executeBatch() of MySQLStatement.class but no super() was called. NPE was thrown based on the same situation. Do you consider to fix it as well?

              People

              • Assignee:
                wlad Vladislav Vaintroub
                Reporter:
                wlad Vladislav Vaintroub
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 10 minutes
                  10m