Revise exception handling in AbstractEmbeddedDatabaseConfigurer
See gh-24337
This commit is contained in:
parent
3f1882c4eb
commit
798744838c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -25,6 +25,8 @@ import javax.sql.DataSource;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.jdbc.support.JdbcUtils;
|
||||
|
||||
/**
|
||||
* Base class for {@link EmbeddedDatabaseConfigurer} implementations
|
||||
* providing common shutdown behavior through a "SHUTDOWN" statement.
|
||||
|
@ -53,14 +55,7 @@ abstract class AbstractEmbeddedDatabaseConfigurer implements EmbeddedDatabaseCon
|
|||
logger.info("Could not shut down embedded database", ex);
|
||||
}
|
||||
finally {
|
||||
if (con != null) {
|
||||
try {
|
||||
con.close();
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
logger.debug("Could not close JDBC Connection on shutdown", ex);
|
||||
}
|
||||
}
|
||||
JdbcUtils.closeConnection(con);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue