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:
None 
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
Description:
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)
  return;
[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:

  http://lists.mysql.com/commits/9287
[4 Dec 2006 13:56] MC Brown
A note has been added to 5.0.3 changelog.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.054 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.