Browse Source

skip collection conversion early if empty

pull/1234/head
Juergen Hoeller 15 years ago
parent
commit
e6b708376d
  1. 4
      org.springframework.beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java

4
org.springframework.beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java

@ -460,7 +460,7 @@ class TypeConverterDelegate { @@ -460,7 +460,7 @@ class TypeConverterDelegate {
Collection original, String propertyName, Class requiredType, TypeDescriptor typeDescriptor) {
boolean originalAllowed = requiredType.isInstance(original);
if (!originalAllowed && !Collection.class.isAssignableFrom(requiredType)) {
if (!originalAllowed && !Collection.class.isAssignableFrom(requiredType) || original.isEmpty()) {
return original;
}
@ -542,7 +542,7 @@ class TypeConverterDelegate { @@ -542,7 +542,7 @@ class TypeConverterDelegate {
Map original, String propertyName, Class requiredType, TypeDescriptor typeDescriptor) {
boolean originalAllowed = requiredType.isInstance(original);
if (!originalAllowed && !Map.class.isAssignableFrom(requiredType)) {
if (!originalAllowed && !Map.class.isAssignableFrom(requiredType) || original.isEmpty()) {
return original;
}

Loading…
Cancel
Save