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);
|
||||
|
||||
@@ -57,7 +57,7 @@ import org.springframework.web.util.WebUtils;
|
||||
* but this behavior can be changed by overriding the
|
||||
* {@link #isEligibleProperty(String, Object)} method.
|
||||
*
|
||||
* <p>A URL for this view is supposed to be a HTTP redirect URL, i.e.
|
||||
* <p>A URL for this view is supposed to be an HTTP redirect URL, i.e.
|
||||
* suitable for HttpServletResponse's {@code sendRedirect} method, which
|
||||
* is what actually does the redirect if the HTTP 1.0 flag is on, or via sending
|
||||
* back an HTTP 303 code - if the HTTP 1.0 compatibility flag is off.
|
||||
@@ -387,7 +387,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