Skip to content

Commit

Permalink
Update RestfulApiHelper.java
Browse files Browse the repository at this point in the history
  • Loading branch information
chenmutime authored Dec 25, 2023
1 parent 3b01532 commit 6bc76f3
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}
}
});
Expand All @@ -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)));
}
}
});
Expand All @@ -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);
}
}
Expand Down

0 comments on commit 6bc76f3

Please sign in to comment.