Bug #9704 statement.getMoreResults() gives NPE
Submitted: 7 Apr 2005 2:35 Modified: 7 Apr 2005 18:48
Reporter: Joel Brown Email Updates:
Status: Closed Impact on me:
Category:Connector / J Severity:S2 (Serious)
Version:3.1.7 OS:Windows (windows XP)
Assigned to: Mark Matthews CPU Architecture:Any

[7 Apr 2005 2:35] Joel Brown
I'm calling 
   hasResults = myStatement.getMoreResults() ;

Which gives me this:
        at com.mysql.jdbc.Statement.getMoreResults(Statement.java:521)
        at com.mysql.jdbc.Statement.getMoreResults(Statement.java:513)
        at MYCLASS.executeSql(QueryProcessor.java:231)

I get NPE's with 3.1.7 and 3.1.6 whereas 3.0.16 works fine.

I'm writing DB independent code where the statement executed may contain more than one result.  Like the javadoc says, I loop until
((stmt.getMoreResults() == false) && (stmt.getUpdateCount() == -1))

but the getMoreResults() gives the NPE.

My server version is 4.0.18-nt

How to repeat:
synopsis of my code:

boolean hasResults = myStatement.execute("select version()") ;
ResultSet rs = myStatement.getResultSet() ;
rs.close() ;
hasResults = myStatement.getMoreResults() ;

Suggested fix:
return false.
[7 Apr 2005 16:18] Sakthivel Gopal
I want to add myself to this bug (#9704) updates-mailing list. I didn't find a way for it. So, I'm adding this comment here to sign up for this bug progress update emails...
[7 Apr 2005 18:48] Mark Matthews
Fixed for 3.1.8. You can test the fix with the nightly snapshot from http://downloads.mysql.com/snapshots.php after 00:00 GMT April 8th.

Thanks for your bug report!
[11 Apr 2005 17:20] Sakthivel Gopal
Thanks for fixing this issue! I have verified the fix with mysql-connector-java-3.1-nightly-20050411 build and it works fine!