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

Oliver Heger commented on BEANUTILS-454:
----------------------------------------

I read the comments posted on BEANUTILS-387 and had a look in the code, and I 
think I can understand why people are not happy with the current situation. 
When doing a copy of an object it is usually desired that a verbatim copy is 
created; replacing *null* references by default values seems to be rather an 
exceptional case. What makes the situation worse is the fact that there is 
different default behavior for different data types (as implemented in the 
{{deregister()}} method of {{ConvertUtilsBean}}: primitive types and "standard" 
types accept *null* values, "other" types (including Date, Calendar, and some 
other types) do not. But for types for which no converter exists, *null* values 
are also accepted.

Is one of the original authors still around and can give some reasons about the 
original design decision? Maybe applying default values makes sense when 
setting properties, but in the case of a copy operation, I am not convinced.

> copyProperties() throws conversion exception for null Date
> ----------------------------------------------------------
>
>                 Key: BEANUTILS-454
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-454
>             Project: Commons BeanUtils
>          Issue Type: Bug
>    Affects Versions: 1.8.0
>            Reporter: Markus Stahl
>            Priority: Critical
>             Fix For: 1.8.4
>
>
> This issue had been reported earlier and rejected too soon. 
> Since 1.8.0, BeanUtils.copyProperties suddenly throws an Exception, if the 
> property is of type Date. It did not do so in prior releases, that's why 
> properly running software is nowadays broken. There is a workaround if the 
> BeanUtils are used in my own code, but if it is used in 3rd party code, I am 
> screwed.
> Please, treat null for Date the same as null for any other type and copy null 
> from source to destination.
> For more reasons, see the comments of people who move now to new releases of 
> BeanUtils facing the same problem. The issue gets more and more attention, 
> but I think, nobody except the reporters are notified about it. Therefore 
> this issue.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to