[CONJ-172] Return from result set not checked creating connection Created: 2015-07-29  Updated: 2015-09-02  Resolved: 2015-07-29

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.2.0
Fix Version/s: 1.2.2

Type: Bug Priority: Minor
Reporter: Geoffrey Rutherford Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None
Environment:

JDBC



 Description   

MySQLProtocol at line 417

SelectQueryResult qr = null;
try

{ qr = (SelectQueryResult) executeQuery(new MySQLQuery("show variables like 'max_allowed_packet'")); qr.next(); setMaxAllowedPacket(qr.getValueObject(1).getInt()); }

finally

{ if (qr != null)qr.close(); }

doesn't check the return from qr.next which can be zero. Code should be:

SelectQueryResult qr = null;
try {
qr = (SelectQueryResult) executeQuery(new MySQLQuery("show variables like 'max_allowed_packet'"));
if (qr.next())
{ setMaxAllowedPacket(qr.getValueObject(1).getInt()); }
} finally { if (qr != null)qr.close(); }

 Comments   
Comment by Diego Dupin [ 2015-07-29 ]

thanks for this point.
done with the commit : https://github.com/MariaDB/mariadb-connector-j/commit/297b234656e084843e0070bbde2a70b5f541f040

Generated at Thu Feb 08 03:13:43 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.