Skip to content

Commit

Permalink
fix: To avoid converting null to "null", skip null passwords (#5057)
Browse files Browse the repository at this point in the history
* Update RestfulApiHelper.java

* fix: add missing import

* fix: format code using mvn
  • Loading branch information
chenmutime authored Dec 29, 2023
1 parent 59e526d commit be7b820
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())));
}
}
});
Expand All @@ -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())));
}
}
});
Expand Down

0 comments on commit be7b820

Please sign in to comment.