Polish: String function use should be optimized for single characters
This commit is contained in:
committed by
Juergen Hoeller
parent
9c55dd5961
commit
49fd724d8f
@@ -367,8 +367,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");
|
||||
|
||||
@@ -317,7 +317,7 @@ class TypeConverterDelegate {
|
||||
|
||||
if (Enum.class == requiredType && this.targetObject != null) {
|
||||
// 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_NAME + 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