From 697db4287ea7cf5e7c3ee5c84279d14b78fd24f0 Mon Sep 17 00:00:00 2001 From: junpakPark <112045553+junpakPark@users.noreply.github.com> Date: Sun, 15 Oct 2023 14:59:02 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20finally=20=EB=B8=94=EB=A1=9D=20?= =?UTF-8?q?=EC=98=88=EC=99=B8=20=EC=8B=9C=20=EB=A1=9C=EA=B9=85=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../support/jdbc/init/DatabasePopulatorUtils.java | 8 ++++++-- .../transaction/support/TransactionManager.java | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/techcourse/support/jdbc/init/DatabasePopulatorUtils.java b/app/src/main/java/com/techcourse/support/jdbc/init/DatabasePopulatorUtils.java index 0a371ecfa3..db8f5cd5de 100644 --- a/app/src/main/java/com/techcourse/support/jdbc/init/DatabasePopulatorUtils.java +++ b/app/src/main/java/com/techcourse/support/jdbc/init/DatabasePopulatorUtils.java @@ -32,13 +32,17 @@ public static void execute(final DataSource dataSource) { if (statement != null) { statement.close(); } - } catch (SQLException ignored) {} + } catch (SQLException e) { + log.warn(String.valueOf(e)); + } try { if (connection != null) { connection.close(); } - } catch (SQLException ignored) {} + } catch (SQLException e) { + log.warn(String.valueOf(e)); + } } } diff --git a/jdbc/src/main/java/org/springframework/transaction/support/TransactionManager.java b/jdbc/src/main/java/org/springframework/transaction/support/TransactionManager.java index 32da7a197b..811d92aa3b 100644 --- a/jdbc/src/main/java/org/springframework/transaction/support/TransactionManager.java +++ b/jdbc/src/main/java/org/springframework/transaction/support/TransactionManager.java @@ -4,12 +4,16 @@ import java.sql.SQLException; import java.util.function.Supplier; import javax.sql.DataSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.datasource.DataSourceUtils; import org.springframework.transaction.TransactionException; public class TransactionManager { + private static final Logger log = LoggerFactory.getLogger(TransactionManager.class); + private final DataSource dataSource; public TransactionManager(DataSource dataSource) { @@ -75,7 +79,7 @@ private void release(Connection connection) { DataSourceUtils.releaseConnection(connection, dataSource); TransactionSynchronizationManager.unbindResource(dataSource); } catch (Exception e) { - throw new TransactionException(e); + log.warn(String.valueOf(e)); } }