Use String.replace in MetadataEncoder
Use String.replace instead of replaceAll in MetadataEncoder; since Java 9, String.replace no longer uses a regex, while replaceAll does. The use case here of replacing a single character does not require a regex. Closes gh-35025 Signed-off-by: Patrick Strawderman <pstrawderman@netflix.com>
This commit is contained in:
parent
f11235ee19
commit
fd2038c927
|
@ -106,8 +106,7 @@ final class MetadataEncoder {
|
||||||
Matcher matcher = VARS_PATTERN.matcher(route);
|
Matcher matcher = VARS_PATTERN.matcher(route);
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
Assert.isTrue(index < routeVars.length, () -> "No value for variable '" + matcher.group(1) + "'");
|
Assert.isTrue(index < routeVars.length, () -> "No value for variable '" + matcher.group(1) + "'");
|
||||||
String value = routeVars[index].toString();
|
String value = routeVars[index].toString().replace(".", "%2E");
|
||||||
value = value.contains(".") ? value.replaceAll("\\.", "%2E") : value;
|
|
||||||
matcher.appendReplacement(sb, value);
|
matcher.appendReplacement(sb, value);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue