| Bug #17099 | NullPointerException at com.mysql.jdbc.Statement.getGeneratedKeys() | ||
|---|---|---|---|
| Submitted: | 3 Feb 2006 13:07 | Modified: | 10 Mar 2006 20:29 | 
| Reporter: | lucho balev | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S3 (Non-critical) | 
| Version: | 3.1.12 | OS: | Linux (Linux Mandrake 9.2) | 
| Assigned to: | CPU Architecture: | Any | |
   [7 Feb 2006 22:26]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/2289
   [17 Feb 2006 22:24]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/2831
   [10 Mar 2006 20:29]
   Mark Matthews        
  Fix will be available in 5.0.1 and 3.1.13. You can try a nightly snapshot from http://downloads.mysql.com/snapshots.php#connector-j if you want to test the fix before it's officially released. Thanks for the bug report.
   [31 Mar 2014 9:38]
   Alexander Soklakov        
  Bug#13581 marked as duplicate of this one.


Description: Hello! I didn't find this bug reported anywhere, so I decided to put it inside your system. Description: 1) inside the javadocs for the getGeneratedKeys() method it is written: If this Statement object did not generate any keys, an empty ResultSet object is returned. 2) I will show an extremely simplified piece of code below, that tests this feature: Statement stmt = conn.createStatement(); ResultSet rSet = stmt.getGeneratedKeys(); if (rSet.next()) {/*we inserted a row, do something*/} else{/*we did not insert a row, do something else*/} stmt.close(); 3) after running this code we get NullPointerException: Exception in thread "main" java.lang.NullPointerException at com.mysql.jdbc.Statement.getGeneratedKeysInternal(Statement.java:1144) at com.mysql.jdbc.Statement.getGeneratedKeys(Statement.java:1125) at Test.main(Test.java:23) 4) I think that this is a bug, or at least NullPointerException is not the proper solution How to repeat: It can aways be repeated. Suggested fix: No suggestions.