[#7909] ExecuteContext.sqlException(SQLException) should accept null

This commit is contained in:
lukaseder 2018-10-02 11:58:09 +02:00
parent 3d1d17ec7d
commit f2eea03c55
2 changed files with 7 additions and 2 deletions

View File

@ -292,6 +292,9 @@ public interface ExecuteContext extends Scope {
* {@link DataAccessException}. To have jOOQ throw your own custom
* {@link RuntimeException}, use {@link #exception(RuntimeException)}
* instead. This may have no effect, if called at the wrong moment.
* <p>
* If <code>null</code> is being passed, jOOQ will internally translate the
* "unavailable" exception to an unspecified {@link DataAccessException}.
*/
void sqlException(SQLException e);

View File

@ -2425,8 +2425,10 @@ final class Tools {
* Translate a {@link SQLException} to a {@link DataAccessException}
*/
static final DataAccessException translate(String sql, SQLException e) {
String message = "SQL [" + sql + "]; " + e.getMessage();
return new DataAccessException(message, e);
if (e != null)
return new DataAccessException("SQL [" + sql + "]; " + e.getMessage(), e);
else
return new DataAccessException("SQL [" + sql + "]; Unspecified SQLException");
}
/**