| Bug #9252 | Connector/J throws a NullPointerException with null Time values | ||
|---|---|---|---|
| Submitted: | 17 Mar 2005 16:22 | Modified: | 27 Apr 2005 13:34 |
| Reporter: | Jean-François Morin | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S2 (Serious) |
| Version: | 3.1.7 | OS: | Any (Any) |
| Assigned to: | CPU Architecture: | Any | |
[17 Mar 2005 16:29]
Mark Matthews
This seems to be related to a known issue that is fixed for 3.1.8, from the CHANGES file: "Fixed ResultSet.getTime() on a NULL value for server-side prepared statements throws NPE." Can you test with a nightly build of 3.1 from http://downloads.mysql.com/snapshots.php ?
[17 Mar 2005 16:45]
Jean-François Morin
Everything works properly. The "return null;" on line 6577 in today's nightly build correctly fixes the bug. Thanks!
[17 Apr 2005 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[27 Apr 2005 13:27]
Jean-François Morin
The bug can be closed, it has been fixed in version 3.1.8.
[27 Apr 2005 13:34]
MySQL Verification Team
Thank you for the update.

Description: When reading a ResultSet, I got the following exception: java.lang.NullPointerException at com.mysql.jdbc.ResultSet.getNativeTime(ResultSet.java:6565) at com.mysql.jdbc.ResultSet.getTimeInternal(ResultSet.java:5055) at com.mysql.jdbc.ResultSet.getTime(ResultSet.java:2263) at com.mysql.jdbc.ResultSet.getTime(ResultSet.java:2276) at org.apache.commons.dbcp.DelegatingResultSet.getTime(DelegatingResultSet.java:258) at ... The exception is thrown when a null Time value is found in the results returned by a SELECT query. How to repeat: Given a table containing a Time field, perform a SELECT query that will return at least one null value for that field. Suggested fix: Replace line 6565 of com.mysql.jdbc.ResultSet: int length = bits.length; as follows: int length = bits == null? 0 : bits.length; A length value of 0 will prevent execution of lines 6573 to 6575, which is the only other place where the bits array is used.