fixed test failures with respect to null handling and PropertyTypeDescriptor usage for collection elements

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3448 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller
2010-06-23 19:31:51 +00:00
parent 7fb245167e
commit 568f84f25e
3 changed files with 17 additions and 12 deletions
@@ -172,7 +172,7 @@ public class GenericConversionService implements ConversionService, ConverterReg
}
GenericConverter converter = getConverter(sourceType, targetType);
if (converter == null) {
if (targetType.getType().isInstance(source)) {
if (source == null || targetType.getType().isInstance(source)) {
logger.debug("No converter found - returning assignable source object as-is");
return source;
}
@@ -117,4 +117,13 @@ public class PropertyTypeDescriptor extends TypeDescriptor {
return anns;
}
public TypeDescriptor forElementType(Class<?> elementType) {
if (elementType == null) {
return TypeDescriptor.UNKNOWN;
}
else {
return new PropertyTypeDescriptor(this.propertyDescriptor, getMethodParameter(), elementType);
}
}
}