Refine use of substring operations
Closes gh-25445
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user