Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.8.3
-
None
Description
For BeanUtils converters derived from AbstractConverter it is possible to set a default value. If the default flag is set, this value is returned for null input, but also if a conversion to an unsupported type is attempted (in this case, a conversion of the default value to the target class is tried, but if this fails, the default value is returned directly). This causes the converter to return an object of another class than requested.
IMHO this is a source of ClassCastExceptions and should be changed. A converter should never return an object of a different type than the requested target class. So either perform a successful conversion (if necessary, convert the default value to the target class) or throw an exception.
Attachments
Issue Links
- is related to
-
BEANUTILS-458 BaseLocaleConverter.checkConversionResult() fails with ConversionException when result is null when it should not
- Closed