| Bug #345 | NullPointerException in com.mysql.jdbc.Statement.close() | ||
|---|---|---|---|
| Submitted: | 29 Apr 2003 17:42 | Modified: | 29 Apr 2003 19:43 |
| Reporter: | [ name withheld ] | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S2 (Serious) |
| Version: | 3.1.0-alpha | OS: | Any (All) |
| Assigned to: | CPU Architecture: | Any | |
[29 Apr 2003 19:43]
Mark Matthews
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at
http://www.mysql.com/doc/en/Installing_source_tree.html
[29 Apr 2003 19:43]
Mark Matthews
You can check out the change from the nightly snapshot from http://mmmysql.sourceforge.net/snapshots/dev/

Description: Invoking close() on a closed Statement instance throws NullPointerException. I don't have access to the code which calls close() twice, so I've had to patch the JDBC driver. How to repeat: Connection connection = // get connection PreparedStatement select = connection.prepareStatement(....); ... select.close(); select.close(); Suggested fix: In com.mysql.jdbc.Statement.close(), change: if (this.maxRowsChanged) { this.connection.unsetMaxRows(this); } this.connection.unregisterStatement(this); this.results = null; this.connection = null; to: if (this.maxRowsChanged) { this.connection.unsetMaxRows(this); } if (connection != null) { this.connection.unregisterStatement(this); } this.results = null; this.connection = null;