aliyun / aliyun-odps-jdbc

JDBC Driver for ODPS
Other
125 stars 38 forks source link

[BUG] NPE when closing connection #68

Closed cornmonster closed 5 years ago

cornmonster commented 5 years ago

Describe the bug An NPE occurs when closing odps connection.

To Reproduce To help us reproducing this bug, please provide information below:

  1. 8
  2. 3.0.1
  3. Full stack of the error:
java.lang.NullPointerException
    at com.aliyun.odps.jdbc.OdpsPreparedStatement.close(OdpsPreparedStatement.java:255)
    at com.aliyun.odps.jdbc.OdpsConnection.close(OdpsConnection.java:275)
  1. Minimized code to reproduce the error:
        PreparedStatement pstmt = conn.prepareStatement("INSERT INTO jdbc_test VALUES(?, ?)");

        pstmt.setLong(1, 1L);
        pstmt.setString(2, "foo");
        pstmt.addBatch();

        pstmt.setLong(1, 2L);
        pstmt.setString(2, "bar");
        pstmt.addBatch();

        int[] ret = pstmt.executeBatch();

        assert ret[0] == 1;
        assert ret[1] == 1;

        pstmt.close();
        conn.close();

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.