Minor cleanup of task Properties.expandText() Fix a typo in the comment, and allocate the StringBuffer slightly later in case it might not be needed. Change-Id: Ib5f31d3f7bf6b5a1b2a1a33cf6060d5a86d967fa
diff --git a/src/main/java/com/googlesource/gerrit/plugins/task/Properties.java b/src/main/java/com/googlesource/gerrit/plugins/task/Properties.java index 3568eb8..49cd4cf 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/task/Properties.java +++ b/src/main/java/com/googlesource/gerrit/plugins/task/Properties.java
@@ -323,18 +323,18 @@ } /** - * Expand all properties (${property_name} -> property_value) in the given text . Returns same + * Expand all properties (${property_name} -> property_value) in the given text. Returns same * object if no expansions occured. */ public String expandText(String text) { if (text == null) { return null; } - StringBuffer out = new StringBuffer(); Matcher m = PATTERN.matcher(text); if (!m.find()) { return text; } + StringBuffer out = new StringBuffer(); do { m.appendReplacement(out, Matcher.quoteReplacement(getValueForName(m.group(1)))); } while (m.find());