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..72f5c9f899 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,11 @@ 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(), + new String(new Base64().encode(String.valueOf(password).getBytes()))); } } }); @@ -86,10 +87,11 @@ 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(), + new String(new Base64().decode(String.valueOf(password).getBytes()))); } } });