diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java index ad159489bc..bbe0a19268 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java @@ -1,5 +1,6 @@ package com.fr.design.data.datapane.connect; +import com.fanruan.datasource.driver.bean.DriverLoaderBean; import com.fine.swing.ui.layout.Layouts; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIUtils; @@ -361,7 +362,7 @@ public class JDBCDefPane extends JPanel { private void initMap() { Map driverLoaders = null; try { - driverLoaders = ConnectionRepository.getInstance().getDriverLoaders(); + driverLoaders = toDriverLoaders(ConnectionRepository.getInstance().getDriverLoaders()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); driverLoaders = new HashMap<>(); @@ -370,6 +371,24 @@ public class JDBCDefPane extends JPanel { nameAndRepresent = getDriverLoaderAndRepresent(driverLoaders); } + private Map toDriverLoaders(Map driverLoaders) { + Map map = new HashMap<>(); + for (Map.Entry entry : driverLoaders.entrySet()) { + map.put(entry.getKey(), createDriverLoader(entry.getValue())); + } + return map; + } + + private DriverLoader createDriverLoader(DriverLoaderBean value) { + DriverLoader driverLoader = new DriverLoader(); + driverLoader.setName(value.getName()); + driverLoader.setDriverClass(value.getDriverClass()); + driverLoader.setDriverJarFiles(value.getDriverJarFiles()); + driverLoader.setLoadingStrategy(value.getLoadingStrategy()); + driverLoader.setDriverList(value.getDriverList()); + return driverLoader; + } + private HashBiMap getDriverLoaderAndRepresent(Map driverLoaders) { HashBiMap driverHashBiMap = HashBiMap.create(); if (WorkContext.getCurrent().isWarDeploy()) {