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
This commit is contained in:
parent
c340cf02e0
commit
54bf216425
|
|
@ -520,6 +520,10 @@ class TypeConverterDelegate {
|
||||||
Collection original, String propertyName, Class requiredType, TypeDescriptor typeDescriptor) {
|
Collection original, String propertyName, Class requiredType, TypeDescriptor typeDescriptor) {
|
||||||
|
|
||||||
boolean originalAllowed = requiredType.isInstance(original);
|
boolean originalAllowed = requiredType.isInstance(original);
|
||||||
|
if (!originalAllowed && !Collection.class.isAssignableFrom(requiredType)) {
|
||||||
|
return original;
|
||||||
|
}
|
||||||
|
|
||||||
MethodParameter methodParam = typeDescriptor.getMethodParameter();
|
MethodParameter methodParam = typeDescriptor.getMethodParameter();
|
||||||
Class elementType = null;
|
Class elementType = null;
|
||||||
if (methodParam != null) {
|
if (methodParam != null) {
|
||||||
|
|
@ -594,8 +598,14 @@ class TypeConverterDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@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);
|
boolean originalAllowed = requiredType.isInstance(original);
|
||||||
|
if (!originalAllowed && !Map.class.isAssignableFrom(requiredType)) {
|
||||||
|
return original;
|
||||||
|
}
|
||||||
|
|
||||||
Class keyType = null;
|
Class keyType = null;
|
||||||
Class valueType = null;
|
Class valueType = null;
|
||||||
MethodParameter methodParam = typeDescriptor.getMethodParameter();
|
MethodParameter methodParam = typeDescriptor.getMethodParameter();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue