[ 
https://issues.apache.org/jira/browse/BEANUTILS-445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oliver Heger closed BEANUTILS-445.
----------------------------------


> Converters can return an invalid result object if a default value is set
> ------------------------------------------------------------------------
>
>                 Key: BEANUTILS-445
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-445
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: ConvertUtils & Converters
>    Affects Versions: 1.8.3
>            Reporter: Oliver Heger
>             Fix For: 1.9.0
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to