You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2023/04/03 11:54:20 UTC

[shardingsphere] branch master updated: Fix #24882 (#24972)

This is an automated email from the ASF dual-hosted git repository.

jianglongtao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 560416bae00 Fix #24882 (#24972)
560416bae00 is described below

commit 560416bae0005f31fbed0e8ae0f5381e1762e297
Author: wzhj2326 <79...@qq.com>
AuthorDate: Mon Apr 3 19:54:12 2023 +0800

    Fix #24882 (#24972)
    
    Co-authored-by: wuzhenjie <wu...@smzdm.com>
---
 .../infra/datasource/props/DataSourcePropertiesValidator.java       | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesValidator.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesValidator.java
index a9e5a3a8894..b04abb9494c 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesValidator.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesValidator.java
@@ -24,6 +24,7 @@ import org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolPr
 import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
 
 import javax.sql.DataSource;
+import java.sql.Connection;
 import java.sql.SQLException;
 import java.util.Collection;
 import java.util.LinkedList;
@@ -85,6 +86,9 @@ public final class DataSourcePropertiesValidator {
     }
     
     private void checkFailFast(final DataSource dataSource) throws SQLException {
-        dataSource.getConnection();
+        // CHECKSTYLE:OFF
+        try (Connection ignored = dataSource.getConnection()) {
+            // CHECKSTYLE:ON
+        }
     }
 }