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:
@@ -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 " +
|
||||
|
||||
Reference in New Issue
Block a user