Skip to content

Commit 7987448

Browse files
committed
Revise exception handling in AbstractEmbeddedDatabaseConfigurer
See gh-24337
1 parent 3f1882c commit 7987448

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/AbstractEmbeddedDatabaseConfigurer.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,6 +25,8 @@
2525
import org.apache.commons.logging.Log;
2626
import org.apache.commons.logging.LogFactory;
2727

28+
import org.springframework.jdbc.support.JdbcUtils;
29+
2830
/**
2931
* Base class for {@link EmbeddedDatabaseConfigurer} implementations
3032
* providing common shutdown behavior through a "SHUTDOWN" statement.
@@ -53,14 +55,7 @@ public void shutdown(DataSource dataSource, String databaseName) {
5355
logger.info("Could not shut down embedded database", ex);
5456
}
5557
finally {
56-
if (con != null) {
57-
try {
58-
con.close();
59-
}
60-
catch (Throwable ex) {
61-
logger.debug("Could not close JDBC Connection on shutdown", ex);
62-
}
63-
}
58+
JdbcUtils.closeConnection(con);
6459
}
6560
}
6661

0 commit comments

Comments
 (0)