[jOOQ/jOOQ#11498] DSLContext.connection() and connectionResult() shouldn't produce null Connection when detached
This commit is contained in:
parent
fd756190b1
commit
d93f2be5d8
@ -44,6 +44,7 @@ import org.jooq.conf.Settings;
|
||||
import org.jooq.conf.SettingsTools;
|
||||
import org.jooq.exception.ConfigurationException;
|
||||
import org.jooq.exception.DataAccessException;
|
||||
import org.jooq.exception.DetachedException;
|
||||
import org.jooq.exception.InvalidResultException;
|
||||
import org.jooq.exception.SQLDialectNotSupportedException;
|
||||
import org.jooq.impl.BatchCRUD.Action;
|
||||
@ -439,6 +440,9 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
|
||||
public <T> T connectionResult(ConnectionCallable<T> callable) {
|
||||
final Connection connection = configuration().connectionProvider().acquire();
|
||||
|
||||
if (connection == null)
|
||||
throw new DetachedException("No Connection provided by ConnectionProvider");
|
||||
|
||||
try {
|
||||
return callable.run(connection);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user