File tree Expand file tree Collapse file tree 5 files changed +16
-17
lines changed
spring-beans/src/main/java/org/springframework/beans
spring-core/src/main/java/org/springframework/core
spring-jdbc/src/main/java/org/springframework/jdbc/support
spring-web/src/main/java/org/springframework/web/multipart/support Expand file tree Collapse file tree 5 files changed +16
-17
lines changed Original file line number Diff line number Diff line change @@ -341,10 +341,10 @@ Class<?> getBeanClass() {
341
341
PropertyDescriptor getPropertyDescriptor (String name ) {
342
342
PropertyDescriptor pd = this .propertyDescriptorCache .get (name );
343
343
if (pd == null && StringUtils .hasLength (name )) {
344
- // Same lenient fallback checking as in PropertyTypeDescriptor ...
345
- pd = this .propertyDescriptorCache .get (name . substring ( 0 , 1 ). toLowerCase () + name . substring ( 1 ));
344
+ // Same lenient fallback checking as in Property ...
345
+ pd = this .propertyDescriptorCache .get (StringUtils . uncapitalize ( name ));
346
346
if (pd == null ) {
347
- pd = this .propertyDescriptorCache .get (name . substring ( 0 , 1 ). toUpperCase () + name . substring ( 1 ));
347
+ pd = this .propertyDescriptorCache .get (StringUtils . capitalize ( name ));
348
348
}
349
349
}
350
350
return (pd == null || pd instanceof GenericTypeAwarePropertyDescriptor ? pd :
Original file line number Diff line number Diff line change @@ -239,11 +239,9 @@ private Field getField() {
239
239
field = ReflectionUtils .findField (declaringClass , name );
240
240
if (field == null ) {
241
241
// Same lenient fallback checking as in CachedIntrospectionResults...
242
- field = ReflectionUtils .findField (declaringClass ,
243
- name .substring (0 , 1 ).toLowerCase () + name .substring (1 ));
242
+ field = ReflectionUtils .findField (declaringClass , StringUtils .uncapitalize (name ));
244
243
if (field == null ) {
245
- field = ReflectionUtils .findField (declaringClass ,
246
- name .substring (0 , 1 ).toUpperCase () + name .substring (1 ));
244
+ field = ReflectionUtils .findField (declaringClass , StringUtils .capitalize (name ));
247
245
}
248
246
}
249
247
}
Original file line number Diff line number Diff line change @@ -427,7 +427,7 @@ protected void addClassPathManifestEntries(Set<Resource> result) {
427
427
int prefixIndex = filePath .indexOf (':' );
428
428
if (prefixIndex == 1 ) {
429
429
// Possibly "c:" drive prefix on Windows, to be upper-cased for proper duplicate detection
430
- filePath = filePath . substring ( 0 , 1 ). toUpperCase () + filePath . substring ( 1 );
430
+ filePath = StringUtils . capitalize ( filePath );
431
431
}
432
432
UrlResource jarResource = new UrlResource (ResourceUtils .JAR_URL_PREFIX +
433
433
ResourceUtils .FILE_URL_PREFIX + filePath + ResourceUtils .JAR_URL_SEPARATOR );
Original file line number Diff line number Diff line change @@ -469,24 +469,24 @@ public static String convertUnderscoreNameToPropertyName(@Nullable String name)
469
469
StringBuilder result = new StringBuilder ();
470
470
boolean nextIsUpper = false ;
471
471
if (name != null && name .length () > 0 ) {
472
- if (name .length () > 1 && name .substring ( 1 , 2 ). equals ( "_" ) ) {
473
- result .append (name .substring ( 0 , 1 ). toUpperCase ( ));
472
+ if (name .length () > 1 && name .charAt ( 1 ) == '_' ) {
473
+ result .append (Character . toUpperCase ( name .charAt ( 0 ) ));
474
474
}
475
475
else {
476
- result .append (name .substring ( 0 , 1 ). toLowerCase ( ));
476
+ result .append (Character . toLowerCase ( name .charAt ( 0 ) ));
477
477
}
478
478
for (int i = 1 ; i < name .length (); i ++) {
479
- String s = name .substring ( i , i + 1 );
480
- if (s . equals ( "_" ) ) {
479
+ char c = name .charAt ( i );
480
+ if (c == '_' ) {
481
481
nextIsUpper = true ;
482
482
}
483
483
else {
484
484
if (nextIsUpper ) {
485
- result .append (s .toUpperCase ());
485
+ result .append (Character .toUpperCase (c ));
486
486
nextIsUpper = false ;
487
487
}
488
488
else {
489
- result .append (s .toLowerCase ());
489
+ result .append (Character .toLowerCase (c ));
490
490
}
491
491
}
492
492
}
Original file line number Diff line number Diff line change 21
21
22
22
import org .apache .commons .logging .LogFactory ;
23
23
24
+ import org .springframework .util .StringUtils ;
24
25
import org .springframework .web .multipart .MultipartException ;
25
26
import org .springframework .web .multipart .MultipartHttpServletRequest ;
26
27
import org .springframework .web .multipart .MultipartResolver ;
@@ -67,11 +68,11 @@ public void setResolveLazily(boolean resolveLazily) {
67
68
@ Override
68
69
public boolean isMultipart (HttpServletRequest request ) {
69
70
// Same check as in Commons FileUpload...
70
- if (!"post" .equals (request .getMethod (). toLowerCase ())) {
71
+ if (!"post" .equalsIgnoreCase (request .getMethod ())) {
71
72
return false ;
72
73
}
73
74
String contentType = request .getContentType ();
74
- return (contentType != null && contentType . toLowerCase (). startsWith ( "multipart/" ) );
75
+ return StringUtils . startsWithIgnoreCase (contentType , "multipart/" );
75
76
}
76
77
77
78
@ Override
You can’t perform that action at this time.
0 commit comments