Skip to content

Commit a31763e

Browse files
committed
revise if sensitiveCache is empty
1 parent a8ea721 commit a31763e

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

framework/src/main/java/org/tron/common/logsfilter/DesensitizedConverter.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,17 @@ public static void addSensitive(String key, String value) {
2727
}
2828

2929
public String desensitization(String content) {
30-
if (sensitiveCache.size() > 0) {
31-
Matcher matcher = pattern.matcher(content);
32-
while (matcher.find()) {
33-
String key = matcher.group();
34-
String value = sensitiveCache.getIfPresent(key);
35-
if (value != null) {
36-
content = content.replaceAll(key, value);
37-
} else {
38-
content = content.replaceAll(key, "unknown");
39-
}
30+
Matcher matcher = pattern.matcher(content);
31+
while (matcher.find()) {
32+
String key = matcher.group();
33+
String value = sensitiveCache.getIfPresent(key);
34+
if (value != null) {
35+
content = content.replaceAll(key, value);
36+
} else {
37+
content = content.replaceAll(key, "unknown");
4038
}
4139
}
40+
4241
return content;
4342
}
4443

0 commit comments

Comments
 (0)