Menu

#16 tinySQLResultSet.get... yields NullPointerException if column invalid

v1.0 (example)
open
nobody
None
5
2014-04-14
2014-04-14
Strider
No

In tinySQLResultSet, various get methods (getByte, getBoolean) work via getString. Only some of these methods check against a null string. An invalid column results in getString returning a null string, subsequently resulting in a NullPointerException in str.compare.

Found on version 2.26 under Mac OS 10.9, Java 6 and Java 7. The attached test is in JUnit format.

The fix is easy: Add

if( str == null ) return 0;

as in similar methods (getShort), which do not have this issue.

1 Attachments

Discussion


Log in to post a comment.