Refine use of substring operations

Closes gh-25445
This commit is contained in:
XenoAmess
2020-07-21 23:09:43 +08:00
committed by Sam Brannen
parent cdc234d7db
commit edfc6c0293
14 changed files with 15 additions and 15 deletions

View File

@@ -278,7 +278,7 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
}
else {
if (this.context.endsWith("/")) {
url.append(this.context.substring(0, this.context.length() - 1));
url.append(this.context, 0, this.context.length() - 1);
}
else {
url.append(this.context);

View File

@@ -386,7 +386,7 @@ public class RedirectView extends AbstractUrlBasedView implements SmartView {
if (value == null) {
throw new IllegalArgumentException("Model has no value for key '" + name + "'");
}
result.append(targetUrl.substring(endLastMatch, matcher.start()));
result.append(targetUrl, endLastMatch, matcher.start());
result.append(UriUtils.encodePathSegment(value.toString(), encodingScheme));
endLastMatch = matcher.end();
}