From eab8c723cd7e21fb32cef7062b3a058881501679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Kohlschu=CC=88tter?= Date: Sat, 20 Apr 2024 13:55:51 +0200 Subject: [PATCH] mysql: Code cleanup --- .../org/newsclub/net/mysql/MysqlSocketFactoryTestBase.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/junixsocket-mysql/src/test/java/org/newsclub/net/mysql/MysqlSocketFactoryTestBase.java b/junixsocket-mysql/src/test/java/org/newsclub/net/mysql/MysqlSocketFactoryTestBase.java index 596b594a6..a7e3a7cfe 100644 --- a/junixsocket-mysql/src/test/java/org/newsclub/net/mysql/MysqlSocketFactoryTestBase.java +++ b/junixsocket-mysql/src/test/java/org/newsclub/net/mysql/MysqlSocketFactoryTestBase.java @@ -23,6 +23,7 @@ import java.io.File; import java.sql.Connection; import java.sql.DriverManager; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -58,7 +59,8 @@ public void testDriverManagerConnectionToMysqlSock() throws Exception { .getPassword())) { connected = true; - try (ResultSet rs = conn.prepareStatement("SHOW TABLES").executeQuery()) { + try (PreparedStatement pstmt = conn.prepareStatement("SHOW TABLES"); + ResultSet rs = pstmt.executeQuery()) { if (rs.next()) { assertNotNull(rs.getString(1)); } @@ -69,7 +71,7 @@ public void testDriverManagerConnectionToMysqlSock() throws Exception { } else { throw new TestAbortedWithImportantMessageException(MessageType.TEST_ABORTED_WITH_ISSUES, "Could not connect to MySQL database for testing. Please correct the following definitions: " - + creds.toString()); + + creds.toString(), e); } } }