Replace use of StringBuffer with StringBuilder

With JDK 9, java.util.regex.Matcher received overloaded variants of
appendReplacement() and appendTail() that accept a StringBuilder,
allowing us to replace the use of StringBuffer with StringBuilder.

Closes gh-27822
This commit is contained in:
Marten Deinum 2021-12-15 19:44:50 +01:00 committed by Sam Brannen
parent 2ed7268ded
commit 948f5999c3
2 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -102,7 +102,7 @@ final class MetadataEncoder {
if (ObjectUtils.isEmpty(routeVars)) {
return route;
}
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
int index = 0;
Matcher matcher = VARS_PATTERN.matcher(route);
while (matcher.find()) {

View File

@ -256,7 +256,7 @@ public abstract class UriComponents implements Serializable {
source = sanitizeSource(source);
}
Matcher matcher = NAMES_PATTERN.matcher(source);
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
while (matcher.find()) {
String match = matcher.group(1);
String varName = getVariableName(match);