Refine use of substring operations
Closes gh-25445
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
@@ -245,12 +245,12 @@ public class RedirectView extends AbstractUrlBasedView {
|
||||
String name = matcher.group(1);
|
||||
Object value = (model.containsKey(name) ? model.get(name) : uriVariables.get(name));
|
||||
Assert.notNull(value, () -> "No value for URI variable '" + name + "'");
|
||||
result.append(targetUrl.substring(endLastMatch, matcher.start()));
|
||||
result.append(targetUrl, endLastMatch, matcher.start());
|
||||
result.append(encodeUriVariable(value.toString()));
|
||||
endLastMatch = matcher.end();
|
||||
found = matcher.find();
|
||||
}
|
||||
result.append(targetUrl.substring(endLastMatch, targetUrl.length()));
|
||||
result.append(targetUrl.substring(endLastMatch));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user