From a0d3528ab968cc4bd3a9afa32e0751bc5a2230a9 Mon Sep 17 00:00:00 2001 From: rinoux Date: Thu, 28 Jul 2022 08:51:27 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-76370=20=E6=8F=90=E4=BE=9B=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=89=8D=E7=BD=AE?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E6=8E=A5=E5=8F=A3&=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datapane/connect/ConnectionListPane.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index f6ddfc5b98..8abab76516 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -1,8 +1,6 @@ package com.fr.design.data.datapane.connect; -import com.fr.base.TemplateUtils; import com.fr.config.RemoteConfigEvent; -import com.fr.data.core.db.JDBCSecurityChecker; import com.fr.data.impl.Connection; import com.fr.data.impl.ConnectionBean; import com.fr.data.impl.JDBCDatabaseConnection; @@ -187,7 +185,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh case ADDED: case UPDATED: addedOrUpdatedConnections.add(new ConnectionBean(s, StringUtils.EMPTY, connection)); - if (connection instanceof JDBCDatabaseConnection){ + if (connection instanceof JDBCDatabaseConnection) { DatabaseConnectionMetricHandler.handleSaveConnection((JDBCDatabaseConnection) connection, null); } default: @@ -195,22 +193,19 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh } }); - this.checkSecurity(addedOrUpdatedConnections); + this.validateConnections(addedOrUpdatedConnections); this.alterConnections(removedConnNames, addedOrUpdatedConnections); } - private void checkSecurity(List addedOrUpdatedConnections) throws Exception { + private void validateConnections(List addedOrUpdatedConnections) throws Exception { for (ConnectionBean connectionBean : addedOrUpdatedConnections) { Connection connection = connectionBean.getConnection(); - if (connection instanceof JDBCDatabaseConnection) { - try { - JDBCSecurityChecker.checkURL(TemplateUtils.render(((JDBCDatabaseConnection) connection).getURL())); - JDBCSecurityChecker.checkValidationQuery(((JDBCDatabaseConnection) connection).getDbcpAttr().getValidationQuery()); - } catch (SQLException e) { - throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", connectionBean.getName()) + ", " + e.getMessage(), e.getCause()); - } + try { + connection.validateSettings(); + } catch (Exception e) { + throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", connectionBean.getName()) + ", " + e.getMessage(), e.getCause()); } }