You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Axel Dehning (JIRA)" <ji...@apache.org> on 2018/04/13 13:47:00 UTC

[jira] [Commented] (BEANUTILS-508) BeanUtilsBean convertForCopy does not convert null values

    [ https://issues.apache.org/jira/browse/BEANUTILS-508?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16437321#comment-16437321 ] 

Axel Dehning commented on BEANUTILS-508:
----------------------------------------

Guess it was introduced with BEANUTILS-454.

In fact this by-passing of any converters for null values breaks mapping to primitive target types since no default values can be set anymore.

> BeanUtilsBean convertForCopy does not convert null values
> ---------------------------------------------------------
>
>                 Key: BEANUTILS-508
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-508
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils
>    Affects Versions: 1.9.0, 1.9.1, 1.9.2, 1.9.3
>            Reporter: Chris McFarland
>            Priority: Major
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> BeanUtilsBean convertForCopy(value, type) only calls convert(value, type) for non-null 'value'. This is incorrect because null value handling should be left up to the Converter implementation. As stated in [AbstractConverter javadoc|http://commons.apache.org/proper/commons-beanutils/javadocs/v1.9.3/apidocs/org/apache/commons/beanutils/converters/AbstractConverter.html]: the AbstractConverter(Object defaultValue) constructor sets the "default value to be returned if the value to be converted is missing or an error occurs converting the value."



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)