Skip to content

Commit 0ccba6c

Browse files
authored
Merge pull request #124 from FOCONIS/catch-rollback-error
autocommit/rollback may throw error
2 parents 6e48aaf + 15db0d4 commit 0ccba6c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ebean-datasource/src/main/java/io/ebean/datasource/pool/ConnectionPool.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,13 @@ private void testConnection() {
391391
} finally {
392392
try {
393393
if (conn != null) {
394-
if (!conn.getAutoCommit()) {
395-
conn.rollback();
394+
try {
395+
if (!conn.getAutoCommit()) {
396+
conn.rollback();
397+
}
398+
} finally {
399+
conn.closePooledConnection(false);
396400
}
397-
conn.closePooledConnection(false);
398401
}
399402
} catch (SQLException ex) {
400403
Log.warn("Can't close connection in checkDataSource!");

0 commit comments

Comments
 (0)