[CONJ-429] ResultSet.getDouble/getFloat may throws a NumberFormatException Created: 2017-02-10  Updated: 2017-03-13  Resolved: 2017-03-08

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.5.8
Fix Version/s: 1.5.9

Type: Bug Priority: Major
Reporter: Julien Stegle Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None
Environment:

JDK 1.8.0.25
Windows Server 2012
MariaDB 10.1.19
JPA 2.1.0


Attachments: Text File txtconnectionlistener_java_exception.txt    

 Description   

I've recently encountered an issue using the getDouble method of the driver's resultset.
Instead of throwing an SQLException like expected in the documentation (https://github.com/MariaDB/mariadb-connector-j/blob/hotfix/FIX1.5.8/src/main/java/org/mariadb/jdbc/internal/queryresults/resultset/MariaSelectResultSet.java#L1398), it raises a NumberFormatException when passed an empty string.

The document seems to indicate that this kind of behavior should always throws an SQLException (which is catched in our app).

I'll join the anonymized stacktrace to this issue.



 Comments   
Comment by Julien Stegle [ 2017-03-07 ]

Hi, I was wondering I you could confirm that it's indeed a bug and not the expected behavior ?
Thanks,
Julien Stegle

Comment by Diego Dupin [ 2017-03-07 ]

Hi, this is indeed a bug.

After reading code, this can occur when using ResultSet.getDouble() on a varchar field with a value not numeric, which is permit by JDBC, or another type of field (blob or other).
In every cases, an SQLException must be thrown, with different messages.
That will be handle in next correction release

Comment by Diego Dupin [ 2017-03-08 ]

This can occur using ResultSet.getDouble() or ResultSet.getFloat(). Other numeric type (getInt() ...) are already handled.

Comment by Julien Stegle [ 2017-03-13 ]

Thanks for your reply ! I suppose that the new 1.5.8 version can be pulled from the maven repository ?

Comment by Diego Dupin [ 2017-03-13 ]

Version is available throught maven - version is 1.5.9
(mariadb site will be updated tomorrow normally)

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