Skip to content

Commit fd2038c

Browse files
kilinkbclozel
authored andcommitted
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 <[email protected]>
1 parent f11235e commit fd2038c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

spring-messaging/src/main/java/org/springframework/messaging/rsocket/MetadataEncoder.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ private static String expand(String route, Object... routeVars) {
106106
Matcher matcher = VARS_PATTERN.matcher(route);
107107
while (matcher.find()) {
108108
Assert.isTrue(index < routeVars.length, () -> "No value for variable '" + matcher.group(1) + "'");
109-
String value = routeVars[index].toString();
110-
value = value.contains(".") ? value.replaceAll("\\.", "%2E") : value;
109+
String value = routeVars[index].toString().replace(".", "%2E");
111110
matcher.appendReplacement(sb, value);
112111
index++;
113112
}

0 commit comments

Comments
 (0)