Bug #20650 NPE in Statement.cancel()
Submitted: 23 Jun 2006 8:23 Modified: 4 Dec 2006 13:56
Reporter: Emmanuel Cecchet Email Updates:
Status: Closed Impact on me:
Category:Connector / J Severity:S2 (Serious)
Version:5.0.0beta OS:Any (all)
Assigned to: CPU Architecture:Any

[23 Jun 2006 8:23] Emmanuel Cecchet
If the connection to the server has been lost and the application tries to perform a cleanup of all pending requests, it will try to call statement.cancel() but connection might already be null and therefore cause an NPE (Statement line 334).

How to repeat:
Create a statement, execute, shutdown MySQL, call cancel().

Suggested fix:
Check if connection is null before trying to get the version number.
Statement Line 334, add:
if (this.connection == null)
[4 Jul 2006 8:55] Tonci Grgin
Hi Emmanuel and thanks for your problem report.
Verified as described by reporter with latest driver available from DL area.
[18 Jul 2006 16:49] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

[4 Dec 2006 13:56] MC Brown
A note has been added to 5.0.3 changelog.