Skip to content

Commit

Permalink
[JENKINS-41653] static pattern compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
escoem committed Oct 24, 2017
1 parent 2f01d2c commit 484b700
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -38,6 +38,7 @@ class SecretHandler {
*/ */
protected static final String SECRET_MARKER = "#secret#"; protected static final String SECRET_MARKER = "#secret#";
public static final String OUTPUT_ENCODING = "UTF-8"; public static final String OUTPUT_ENCODING = "UTF-8";
public static final Pattern SECRET_PATTERN = Pattern.compile(">\\{(.*)\\}<|>(.*)\\=<");


/** /**
* find the secret in the xml file and replace it with the place holder * find the secret in the xml file and replace it with the place holder
Expand Down Expand Up @@ -100,7 +101,7 @@ public void characters(char[] ch, int start, int length) throws SAXException {




private static String findSecretFallback(String xml) { private static String findSecretFallback(String xml) {
Matcher matcher = Pattern.compile(">\\{(.*)\\}<|>(.*)\\=<").matcher(xml); Matcher matcher = SECRET_PATTERN.matcher(xml);
while(matcher.find()) { while(matcher.find()) {
String secret = matcher.group(); String secret = matcher.group();
if(secret.length() > 1) if(secret.length() > 1)
Expand Down

0 comments on commit 484b700

Please sign in to comment.