[jOOQ/jOOQ#10686] ConnectionRunnable and ConnectionCallable should
accept throwing Throwable
This commit is contained in:
parent
f491e8c166
commit
0dc27d7102
@ -66,9 +66,9 @@ public interface ConnectionCallable<T> {
|
||||
*
|
||||
* @param connection The connection.
|
||||
* @return The outcome of the callable.
|
||||
* @throws Exception Any exception, including {@link SQLException}, that
|
||||
* @throws Throwable Any exception, including {@link SQLException}, that
|
||||
* will be propagated as an unchecked
|
||||
* {@link DataAccessException}.
|
||||
*/
|
||||
T run(Connection connection) throws Exception;
|
||||
T run(Connection connection) throws Throwable;
|
||||
}
|
||||
|
||||
@ -65,9 +65,9 @@ public interface ConnectionRunnable {
|
||||
* this {@link ConnectionRunnable}.
|
||||
*
|
||||
* @param connection The connection.
|
||||
* @throws Exception Any exception, including {@link SQLException}, that
|
||||
* @throws Throwable Any exception, including {@link SQLException}, that
|
||||
* will be propagated as an unchecked
|
||||
* {@link DataAccessException}.
|
||||
*/
|
||||
void run(Connection connection) throws Exception;
|
||||
void run(Connection connection) throws Throwable;
|
||||
}
|
||||
|
||||
@ -660,11 +660,14 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
|
||||
try {
|
||||
return callable.run(connection);
|
||||
}
|
||||
catch (Error e) {
|
||||
throw e;
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new DataAccessException("Error while running ConnectionCallable", e);
|
||||
catch (Throwable t) {
|
||||
throw new DataAccessException("Error while running ConnectionCallable", t);
|
||||
}
|
||||
finally {
|
||||
configuration().connectionProvider().release(connection);
|
||||
@ -675,7 +678,7 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
|
||||
public void connection(final ConnectionRunnable runnable) {
|
||||
connectionResult(new ConnectionCallable<Void>() {
|
||||
@Override
|
||||
public Void run(Connection connection) throws Exception {
|
||||
public Void run(Connection connection) throws Throwable {
|
||||
runnable.run(connection);
|
||||
return null;
|
||||
}
|
||||
@ -2820,6 +2823,12 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
|
||||
try {
|
||||
return callable.run(c);
|
||||
}
|
||||
catch (Error e) {
|
||||
throw e;
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (Throwable t) {
|
||||
throw new DataAccessException("Error while running BatchedCallable", t);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user