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
@@ -311,8 +311,8 @@ public abstract class BeanUtils {
|
||||
public static Method resolveSignature(String signature, Class<?> clazz) {
|
||||
Assert.hasText(signature, "'signature' must not be empty");
|
||||
Assert.notNull(clazz, "Class must not be null");
|
||||
int firstParen = signature.indexOf("(");
|
||||
int lastParen = signature.indexOf(")");
|
||||
int firstParen = signature.indexOf('(');
|
||||
int lastParen = signature.indexOf(')');
|
||||
if (firstParen > -1 && lastParen == -1) {
|
||||
throw new IllegalArgumentException("Invalid method signature '" + signature +
|
||||
"': expected closing ')' for args list");
|
||||
|
||||
@@ -325,7 +325,7 @@ class TypeConverterDelegate {
|
||||
|
||||
if (Enum.class == requiredType) {
|
||||
// target type is declared as raw enum, treat the trimmed value as <enum.fqn>.FIELD_NAME
|
||||
int index = trimmedValue.lastIndexOf(".");
|
||||
int index = trimmedValue.lastIndexOf('.');
|
||||
if (index > - 1) {
|
||||
String enumType = trimmedValue.substring(0, index);
|
||||
String fieldName = trimmedValue.substring(index + 1);
|
||||
|
||||
@@ -58,7 +58,7 @@ public class BeansDtdResolver implements EntityResolver {
|
||||
"] and system ID [" + systemId + "]");
|
||||
}
|
||||
if (systemId != null && systemId.endsWith(DTD_EXTENSION)) {
|
||||
int lastPathSeparator = systemId.lastIndexOf("/");
|
||||
int lastPathSeparator = systemId.lastIndexOf('/');
|
||||
int dtdNameStart = systemId.indexOf(DTD_NAME, lastPathSeparator);
|
||||
if (dtdNameStart != -1) {
|
||||
String dtdFile = DTD_FILENAME + DTD_EXTENSION;
|
||||
|
||||
@@ -88,7 +88,7 @@ public class UtilNamespaceHandler extends NamespaceHandlerSupport {
|
||||
parserContext.getReaderContext().error("Attribute 'path' must not be empty", element);
|
||||
return;
|
||||
}
|
||||
int dotIndex = path.indexOf(".");
|
||||
int dotIndex = path.indexOf('.');
|
||||
if (dotIndex == -1) {
|
||||
parserContext.getReaderContext().error(
|
||||
"Attribute 'path' must follow pattern 'beanName.propertyName'", element);
|
||||
|
||||
Reference in New Issue
Block a user