Polish: String function use should be optimized for single characters
(cherry picked from commit 49fd724)
This commit is contained in:
committed by
Juergen Hoeller
parent
073e78b68d
commit
39ddd0f349
@@ -65,8 +65,8 @@ class SimpleCommandLineArgsParser {
|
||||
String optionName;
|
||||
String optionValue = null;
|
||||
if (optionText.contains("=")) {
|
||||
optionName = optionText.substring(0, optionText.indexOf("="));
|
||||
optionValue = optionText.substring(optionText.indexOf("=")+1, optionText.length());
|
||||
optionName = optionText.substring(0, optionText.indexOf('='));
|
||||
optionValue = optionText.substring(optionText.indexOf('=')+1, optionText.length());
|
||||
}
|
||||
else {
|
||||
optionName = optionText;
|
||||
|
||||
@@ -287,7 +287,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||
// Generally only look for a pattern after a prefix here,
|
||||
// and on Tomcat only after the "*/" separator for its "war:" protocol.
|
||||
int prefixEnd = (locationPattern.startsWith("war:") ? locationPattern.indexOf("*/") + 1 :
|
||||
locationPattern.indexOf(":") + 1);
|
||||
locationPattern.indexOf(':') + 1);
|
||||
if (getPathMatcher().isPattern(locationPattern.substring(prefixEnd))) {
|
||||
// a file pattern
|
||||
return findPathMatchingResources(locationPattern);
|
||||
@@ -525,7 +525,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||
* @see #retrieveMatchingFiles
|
||||
*/
|
||||
protected String determineRootDir(String location) {
|
||||
int prefixEnd = location.indexOf(":") + 1;
|
||||
int prefixEnd = location.indexOf(':') + 1;
|
||||
int rootDirEnd = location.length();
|
||||
while (rootDirEnd > prefixEnd && getPathMatcher().isPattern(location.substring(prefixEnd, rootDirEnd))) {
|
||||
rootDirEnd = location.lastIndexOf('/', rootDirEnd - 2) + 1;
|
||||
|
||||
@@ -634,7 +634,7 @@ public abstract class StringUtils {
|
||||
// first path element. This is necessary to correctly parse paths like
|
||||
// "file:core/../core/io/Resource.class", where the ".." should just
|
||||
// strip the first "core" directory while keeping the "file:" prefix.
|
||||
int prefixIndex = pathToUse.indexOf(":");
|
||||
int prefixIndex = pathToUse.indexOf(':');
|
||||
String prefix = "";
|
||||
if (prefixIndex != -1) {
|
||||
prefix = pathToUse.substring(0, prefixIndex + 1);
|
||||
|
||||
Reference in New Issue
Block a user