Browse Source

typed map and collection conversion routines now eagerly reject non-assignable required types and avoid spurious InvocationException stack traces in debug log (SPR-7058)

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3221 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Chris Beams 16 years ago
parent
commit
54bf216425
  1. 12
      org.springframework.beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java

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

@ -520,6 +520,10 @@ class TypeConverterDelegate { @@ -520,6 +520,10 @@ class TypeConverterDelegate {
Collection original, String propertyName, Class requiredType, TypeDescriptor typeDescriptor) {
boolean originalAllowed = requiredType.isInstance(original);
if (!originalAllowed && !Collection.class.isAssignableFrom(requiredType)) {
return original;
}
MethodParameter methodParam = typeDescriptor.getMethodParameter();
Class elementType = null;
if (methodParam != null) {
@ -594,8 +598,14 @@ class TypeConverterDelegate { @@ -594,8 +598,14 @@ class TypeConverterDelegate {
}
@SuppressWarnings("unchecked")
protected Map convertToTypedMap(Map original, String propertyName, Class requiredType, TypeDescriptor typeDescriptor) {
protected Map convertToTypedMap(
Map original, String propertyName, Class requiredType, TypeDescriptor typeDescriptor) {
boolean originalAllowed = requiredType.isInstance(original);
if (!originalAllowed && !Map.class.isAssignableFrom(requiredType)) {
return original;
}
Class keyType = null;
Class valueType = null;
MethodParameter methodParam = typeDescriptor.getMethodParameter();

Loading…
Cancel
Save