diff --git a/linkis-public-enhancements/linkis-datasource/linkis-datasource-manager/server/src/main/java/org/apache/linkis/datasourcemanager/core/restful/RestfulApiHelper.java b/linkis-public-enhancements/linkis-datasource/linkis-datasource-manager/server/src/main/java/org/apache/linkis/datasourcemanager/core/restful/RestfulApiHelper.java index 9651bb265b..b8acf14621 100644 --- a/linkis-public-enhancements/linkis-datasource/linkis-datasource-manager/server/src/main/java/org/apache/linkis/datasourcemanager/core/restful/RestfulApiHelper.java +++ b/linkis-public-enhancements/linkis-datasource/linkis-datasource-manager/server/src/main/java/org/apache/linkis/datasourcemanager/core/restful/RestfulApiHelper.java @@ -66,10 +66,10 @@ public static void encryptPasswordKey( keyDefinitionList.forEach( keyDefinition -> { if (keyDefinition.getValueType() == DataSourceParamKeyDefinition.ValueType.PASSWORD) { - String password = String.valueOf(connectParams.get(keyDefinition.getKey())); + Object password = connectParams.get(keyDefinition.getKey()); if (null != password) { connectParams.put( - keyDefinition.getKey(), new String(new Base64().encode(password.getBytes()))); + keyDefinition.getKey(), CryptoUtils.object2String(String.valueOf(password))); } } }); @@ -86,10 +86,10 @@ public static void decryptPasswordKey( keyDefinitionList.forEach( keyDefinition -> { if (keyDefinition.getValueType() == DataSourceParamKeyDefinition.ValueType.PASSWORD) { - String password = String.valueOf(connectParams.get(keyDefinition.getKey())); + Object password = connectParams.get(keyDefinition.getKey()); if (null != password) { connectParams.put( - keyDefinition.getKey(), new String(new Base64().decode(password.getBytes()))); + keyDefinition.getKey(), CryptoUtils.object2String(String.valueOf(password))); } } }); @@ -110,6 +110,7 @@ public static Message doAndResponse(TryOperation tryOperation, String failMessag } catch (WarnException e) { return Message.warn(e.getMessage()); } catch (Exception e) { + e.printStackTrace(); return Message.error(failMessage, e); } }