From aa9794526d76a081629803617781eb86179155cd Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Fri, 18 Sep 2009 20:32:41 +0000 Subject: [PATCH] updated for change in conversion service api; source type desc now required git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1935 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../springframework/beans/TypeConverterDelegate.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java b/org.springframework.beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java index 1725ae68e2a..85f60173174 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java @@ -166,16 +166,17 @@ class TypeConverterDelegate { // No custom editor but custom ConversionService specified? ConversionService conversionService = this.propertyEditorRegistry.getConversionService(); if (editor == null && conversionService != null && convertedValue != null) { - TypeDescriptor typeDesc; + TypeDescriptor sourceTypeDesc = TypeDescriptor.valueOf(convertedValue.getClass()); + TypeDescriptor targetTypeDesc; if (methodParam != null) { - typeDesc = (descriptor != null ? + targetTypeDesc = (descriptor != null ? new BeanTypeDescriptor(methodParam, descriptor) : new TypeDescriptor(methodParam)); } else { - typeDesc = TypeDescriptor.valueOf(requiredType); + targetTypeDesc = TypeDescriptor.valueOf(requiredType); } - if (conversionService.matches(convertedValue.getClass(), typeDesc)) { - return (T) conversionService.convert(convertedValue, typeDesc); + if (conversionService.canConvert(sourceTypeDesc, targetTypeDesc)) { + return (T) conversionService.convert(convertedValue, sourceTypeDesc, targetTypeDesc); } }