Browse Source

Pull request #14741: REPORT-132873 【fr-fbp回归】fbp工程,数据连接驱动检测异常

Merge in DESIGN/design from ~DESTINY.LIN/design:fbp/release to fbp/release

* commit '8649dbe258e16e22b822cdbbbe00c9164700d306':
  REPORT-132873 【fr-fbp回归】fbp工程,数据连接驱动检测异常
fbp/release
Destiny.Lin-林锦龙 3 months ago
parent
commit
6926149583
  1. 9
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  2. 8
      designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java
  3. 2
      designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java

9
designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java

@ -5,7 +5,6 @@ package com.fr.design.data.datapane.connect;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
@ -13,7 +12,6 @@ import com.fr.data.driver.util.JarFileParseUtil;
import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.data.operator.DataOperatorProvider;
import com.fr.data.security.ssl.impl.NormalSsl;
import com.fr.data.solution.ExceptionSolutionSelector;
import com.fr.data.solution.entity.DriverPage;
@ -31,14 +29,12 @@ import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.engine.exception.DriverUnExistException;
import org.jetbrains.annotations.NotNull;
import com.fr.workspace.server.entity.connection.ConnectionBean;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import javax.swing.JDialog;
@ -479,6 +475,9 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
uiLabel.setIcon(new LazyIcon("error", 20));
message.setText(Toolkit.i18nText("Fine-Design_Basic_Connection_Failed"));
Connection database = DatabaseConnectionPane.this.updateBean();
if (e.getCause() instanceof DriverUnExistException) {
((DriverUnExistException) e.getCause()).setThrowable(new ClassNotFoundException(database.getDriver()));
}
SolutionProcessor select = ExceptionSolutionSelector.get().select(e, database);
String detail = select.getResultException().getDetailMessage();
String solution = select.getResultException().getSolution();

8
designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java

@ -3,10 +3,12 @@ package com.fr.design.data.datapane.connect;
import com.fr.data.driver.DriverClassNotFoundException;
import com.fr.data.impl.Connection;
import com.fr.decision.webservice.bean.datasource.ConnectionInfoBean;
import com.fr.decision.webservice.exception.general.DriverNotFoundException;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionProcessorFactory;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory;
import com.fr.security.encryption.transmission.TransmissionEncryptionManager;
import com.fr.workspace.engine.exception.DriverUnExistException;
import com.fr.workspace.server.repository.connection.BaseConnectionSource;
import java.sql.SQLException;
@ -25,6 +27,8 @@ public class LocalConnectionSource extends BaseConnectionSource {
// 暂时这么处理,后续最好拉到外层包装一下
TransmissionEncryptionManager.setTransEncryptionLevel(1);
ConnectionProcessorFactory.testConnectionWithSchemaReturn(database);
} catch (DriverNotFoundException e) {
throw new DriverUnExistException();
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
}
@ -36,6 +40,8 @@ public class LocalConnectionSource extends BaseConnectionSource {
Connection connection = ConnectionProcessorFactory.createConnection(bean);
validate(bean.getConnectionName(), connection);
ConnectionProcessorFactory.addConnection(bean);
} catch (DriverNotFoundException e) {
throw new DriverUnExistException();
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
}
@ -54,6 +60,8 @@ public class LocalConnectionSource extends BaseConnectionSource {
Connection connection = ConnectionProcessorFactory.createConnection(bean);
validate(bean.getConnectionName(), connection);
ConnectionProcessorFactory.updateConnection(bean.getConnectionName(), bean);
} catch (DriverNotFoundException e) {
throw new DriverUnExistException();
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
}

2
designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java

@ -49,6 +49,7 @@ import com.fr.workspace.engine.FineWorkspaceFactory;
import com.fr.workspace.engine.base.FineObjectPool;
import com.fr.workspace.engine.client.heartbeart.FineWorkspaceHeartbeat;
import com.fr.workspace.engine.client.heartbeart.WorkspaceHeartbeat;
import com.fr.workspace.engine.exception.RemoteDriverUnExistHandler;
import com.fr.workspace.engine.resource.FineWorkResource;
import com.fr.workspace.engine.resource.FineWorkResourceAdaptor;
import com.fr.workspace.pool.WorkRPCRegister;
@ -153,6 +154,7 @@ public class DesignWorkContextComponent {
RemoteExceptionConvert.registerException(HttpConstants.PASSWORD_EMPTY_ERROR_CODE, new RemoteDesignUserPwdErrorHandler());
RemoteExceptionConvert.registerException(HttpConstants.LOGIN_LOCK, new RemoteDesignLoginLockHandler());
RemoteExceptionConvert.registerException(HttpConstants.TPL_HAS_BEAN_UNLOCK, new UnLockedHandler());
RemoteExceptionConvert.registerException(HttpConstants.DRIVER_NOT_EXIST, new RemoteDriverUnExistHandler());
}
private void supplementalCommon() {

Loading…
Cancel
Save