Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ static String expandUriComponent(@Nullable String source, UriTemplateVariables u
*/
private static String sanitizeSource(String source) {
int level = 0;
StringBuilder sb = new StringBuilder();
int lastCharIndex = 0;
char[] chars = new char[source.length()];
for (char c : source.toCharArray()) {
if (c == '{') {
level++;
Expand All @@ -287,9 +288,9 @@ private static String sanitizeSource(String source) {
if (level > 1 || (level == 1 && c == '}')) {
continue;
}
sb.append(c);
chars[lastCharIndex++] = c;
}
return sb.toString();
return new String(chars, 0, lastCharIndex);
}

private static String getVariableName(String match) {
Expand Down