Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
1.1.6, 1.1.7
-
None
-
None
Description
Since getValueObject(columnIndex).getTimestamp(cal) may return null, the method can throw NullPointerException
public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
|
try {
|
return new Timestamp(getValueObject(columnIndex).getTimestamp(cal).getTime());
|
} catch (ParseException e) {
|
throw SQLExceptionMapper.getSQLException("Could not parse timestamp",e);
|
}
|
}
|
Easy fix is to check for null before attempting to call getTime()
public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
|
try {
|
Timestamp timestamp = getValueObject(columnIndex).getTimestamp(cal);
|
|
return timestamp == null ? null : new Timestamp(timestamp.getTime());
|
} catch (ParseException e) {
|
throw SQLExceptionMapper.getSQLException("Could not parse timestamp",e);
|
}
|
}
|