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:
Patrick Strawderman
2025-06-10 14:28:32 -07:00
committed by Brian Clozel
parent f11235ee19
commit fd2038c927

View File

@@ -106,8 +106,7 @@ final class MetadataEncoder {
Matcher matcher = VARS_PATTERN.matcher(route);
while (matcher.find()) {
Assert.isTrue(index < routeVars.length, () -> "No value for variable '" + matcher.group(1) + "'");
String value = routeVars[index].toString();
value = value.contains(".") ? value.replaceAll("\\.", "%2E") : value;
String value = routeVars[index].toString().replace(".", "%2E");
matcher.appendReplacement(sb, value);
index++;
}