[CONJ-190] 'getSqlState' vs 'getSQLState' in QueryException Created: 2015-09-02  Updated: 2017-01-05  Resolved: 2017-01-05

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.2.0
Fix Version/s: 2.0.0-RC

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


 Description   

report from github (https://github.com/MariaDB/mariadb-connector-j/issues/37) created by bbundy

Should this actually be spelled 'getSQLState'? It is causing ruby Sequel to fail here:
https://github.com/jeremyevans/sequel/blob/master/lib/sequel/adapters/jdbc.rb#L396

If I issue a long-running query via Sequel and set a breakpoint on the line:
super || (cause.respond_to?(:getSQLState) && cause.getSQLState =~ /^08/)

and manually kill the query, I get
Java::OrgMariadbJdbcInternalCommon::QueryException Could not read resultset: unexpected end of stream, read 0bytes from 4

but cause.respond_to?(:getSQLState) is false!
(if I monkeypatch this in Sequel to 'cause.respond_to?(:getSqlState)' in the Sequel source, it all works fine)

this appears to be due to the spelling in
https://github.com/MariaDB/mariadb-connector-j/blob/master/src/main/java/org/mariadb/jdbc/internal/common/QueryException.java#L135
(which is 'getSqlState')

which is correct? I would think for consistency with
http://docs.oracle.com/javase/7/docs/api/java/sql/SQLException.html
it should be 'getSQLState'.

The failure of Sequel to properly identify disconnect errors can cause problems with its threaded connection pool: if the closed connection is mistakenly returned to the pool, the next request that uses it fails unexpectedly.

Thanks for looking into this!



 Comments   
Comment by Diego Dupin [ 2017-01-05 ]

fixed in 1.6.0

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