sqlsheet
sqlsheet copied to clipboard
ResultRset get<Number> throws NullPointerException if the cell is empty
Any empty cell withResultSet.get<Number> methods (e.g. getInt(), getFloat(),
...).
In JDBC with real database return zero value not throwing NullPointerException
or return null value.
It seems it can be fixed by simplely check "cell.doubleValue == null" in
get<Number> methods like this:
return (<type>) ((cell == null) ? 0.0D : cell.doubleValue.doubleValue());
-->
return (<type>) ((cell == null || cell.doubleValue == null) ? 0.0D :
cell.doubleValue.doubleValue());
Original issue reported on code.google.com by [email protected] on 23 Jul 2014 at 11:26
I just realize that the code in my previous comments not exactly same as in
source code and here are updated code based on source code:
return (<type>) (cell == null ? 0 : cell.doubleValue);
-->
return (<type>) (cell == null || cell.doubleValue == null? 0 :
cell.doubleValue);
Original comment by [email protected] on 23 Jul 2014 at 11:37
This has been solved quite a while ago.