Browse Source

Revise exception handling in AbstractEmbeddedDatabaseConfigurer

See gh-24337
pull/24356/head
Sam Brannen 6 years ago
parent
commit
798744838c
  1. 13
      spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/AbstractEmbeddedDatabaseConfigurer.java

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

@ -1,5 +1,5 @@ @@ -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; @@ -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 @@ -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…
Cancel
Save