Skip to content

Commit 30a07b2

Browse files
committed
dbeaver的导入问题修复
1 parent a3d0eca commit 30a07b2

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

  • chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ncx/service/impl

chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ncx/service/impl/ConverterServiceImpl.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,14 @@ public UploadVO dbpUploadFile(File file) {
231231
dataSourceDO.setSsh(JSON.toJSONString(sshInfo));
232232
if (null != credentialsJson) {
233233
JSONObject userInfo = credentialsJson.getJSONObject(key);
234-
JSONObject userPassword = userInfo.getJSONObject(connection);
235-
dataSourceDO.setUserName(userPassword.getString("user"));
236-
DesUtil desUtil = new DesUtil(DesUtil.DES_KEY);
237-
String password = userPassword.getString("password");
238-
String encryptStr = desUtil.encrypt(Optional.ofNullable(password).orElse(""), "CBC");
239-
dataSourceDO.setPassword(encryptStr);
234+
if (null != userInfo) {
235+
JSONObject userPassword = userInfo.getJSONObject(connection);
236+
dataSourceDO.setUserName(userPassword.getString("user"));
237+
DesUtil desUtil = new DesUtil(DesUtil.DES_KEY);
238+
String password = userPassword.getString("password");
239+
String encryptStr = desUtil.encrypt(Optional.ofNullable(password).orElse(""), "CBC");
240+
dataSourceDO.setPassword(encryptStr);
241+
}
240242
}
241243
dataSourceDO.setType(dataBaseType.name());
242244
getDataSourceMapper().insert(dataSourceDO);

0 commit comments

Comments
 (0)