SPR-9498: don't make assumptions about equality if ConversionService has failed

The failure of the conversion service is not fatal, but the check that
was in there (line 248) was inadequate to detect the cases that could
already be handled by the default property editors.  This code path
was also not tested anywhere in spring-beans tests until now.
This commit is contained in:
Dave Syer
2012-06-14 11:40:28 +01:00
parent 3ba4bb31fa
commit 8e754e9065
2 changed files with 30 additions and 2 deletions

View File

@@ -44,6 +44,7 @@ import org.springframework.util.StringUtils;
*
* @author Juergen Hoeller
* @author Rob Harrop
* @author Dave Syer
* @since 2.0
* @see BeanWrapperImpl
* @see SimpleTypeConverter
@@ -244,7 +245,7 @@ class TypeConverterDelegate {
}
if (firstAttemptEx != null) {
if (editor == null && convertedValue == newValue) {
if (editor == null && convertedValue == newValue && requiredType!=null && !ClassUtils.isAssignableValue(requiredType, convertedValue)) {
throw firstAttemptEx;
}
logger.debug("Original ConversionService attempt failed - ignored since " +