MariaDB Client Library for Java Applications
  1. MariaDB Client Library for Java Applications
  2. CONJ-62

NullPointerException when executeBatch is called, and batch list is empty

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: jdbc-1.1.4
    • Labels:
      None
    • Global Rank:
      3587

      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.

        Activity

        Hide
        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
        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:
            Vladislav Vaintroub
            Reporter:
            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