mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-7575: improved performance of cleanString method in StringUtils
(cherry picked from commit 7972f53c8d)
This commit is contained in:
parent
549840dd0d
commit
e43d5b1c7d
|
|
@ -159,9 +159,7 @@ public class StringUtils {
|
|||
}
|
||||
|
||||
// removes a password request param and it's value, also considering password is in query parameter value which has been url encoded
|
||||
private static final Pattern REGEX_PASSWORD_QUERYSTRING = Pattern.compile("(&|%26)?[^(&|%26)]*((p|P)assword|accesskey|secretkey)(=|%3D).*?(?=(%26|[&'\"]))");
|
||||
|
||||
private static final Pattern REGEX_END_PASSWORD_QUERYSTRING = Pattern.compile("(&|%26)[^(&|%26)]*((p|P)assword|accesskey|secretkey)(=|%3D).*");
|
||||
private static final Pattern REGEX_PASSWORD_QUERYSTRING = Pattern.compile("(&|%26)?[^(&|%26)]*((p|P)assword|accesskey|secretkey)(=|%3D).*?(?=(%26|[&'\"]|$))");
|
||||
|
||||
// removes a password/accesskey/ property from a response json object
|
||||
private static final Pattern REGEX_PASSWORD_JSON = Pattern.compile("\"((p|P)assword|accesskey|secretkey)\":\\s?\".*?\",?");
|
||||
|
|
@ -177,7 +175,6 @@ public class StringUtils {
|
|||
String cleanResult = "";
|
||||
if (stringToClean != null) {
|
||||
cleanResult = REGEX_PASSWORD_QUERYSTRING.matcher(stringToClean).replaceAll("");
|
||||
cleanResult = REGEX_END_PASSWORD_QUERYSTRING.matcher(cleanResult).replaceAll("");
|
||||
cleanResult = REGEX_PASSWORD_JSON.matcher(cleanResult).replaceAll("");
|
||||
Matcher detailsMatcher = REGEX_PASSWORD_DETAILS.matcher(cleanResult);
|
||||
while (detailsMatcher.find()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue