Quote string replacements to avoid pattern issues

This commit is contained in:
Nathan Adams 2017-06-22 09:35:33 +02:00
parent 7ac8998e5a
commit f0f038b57a

View file

@ -30,7 +30,7 @@ public class ParameterizedCommandExceptionType implements CommandExceptionType {
final Matcher matcher = PATTERN.matcher(message); final Matcher matcher = PATTERN.matcher(message);
final StringBuffer result = new StringBuffer(); final StringBuffer result = new StringBuffer();
while (matcher.find()) { while (matcher.find()) {
matcher.appendReplacement(result, exception.getData().get(matcher.group(1)).toString()); matcher.appendReplacement(result, Matcher.quoteReplacement(exception.getData().get(matcher.group(1)).toString()));
} }
matcher.appendTail(result); matcher.appendTail(result);
return result.toString(); return result.toString();