From a0d3528ab968cc4bd3a9afa32e0751bc5a2230a9 Mon Sep 17 00:00:00 2001 From: rinoux Date: Thu, 28 Jul 2022 08:51:27 +0800 Subject: [PATCH 1/2] =?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()); } } From a7f480e69febf415cf8dcfafaa8c5bcaae7ff44a Mon Sep 17 00:00:00 2001 From: rinoux Date: Thu, 28 Jul 2022 11:09:45 +0800 Subject: [PATCH 2/2] =?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&=E5=86=99=E9=94=99?= =?UTF-8?q?=E4=BA=86=E5=BA=94=E8=AF=A5=E6=98=AF=E8=BF=9C=E7=A8=8B=E8=B0=83?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/datapane/connect/ConnectionListPane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 8abab76516..e750fa3488 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 @@ -6,6 +6,7 @@ import com.fr.data.impl.ConnectionBean; import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.data.metric.utils.DatabaseConnectionMetricHandler; +import com.fr.data.operator.DataOperator; import com.fr.design.ExtraDesignClassManager; import com.fr.design.data.MapCompareUtils; import com.fr.design.dialog.BasicDialog; @@ -203,7 +204,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh for (ConnectionBean connectionBean : addedOrUpdatedConnections) { Connection connection = connectionBean.getConnection(); try { - connection.validateSettings(); + DataOperator.getInstance().validateConnectionSettings(connection); } catch (Exception e) { throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", connectionBean.getName()) + ", " + e.getMessage(), e.getCause()); }