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

Timm Frenzel commented on BEANUTILS-387:
----------------------------------------

For me it's also a big issue. We are using a third-party software that allows 
for customization by just extending from the provided Bean classes and 
configuring those in the software system. In our extension we use a bean 
property of type 'Calendar' (which produces the same issue as a Date). The 
software uses copyProperties() to handle those extensions. It was recently 
upgraded by the manufacturer and now uses the beanutils 1.8 package. But now 
the software fails due to this changed behavior in copyProperties(). We cannot 
register any custom converter in this software. So the changed behavior of 
copyProperties() breaks our software(!). Therefore I strongly vote for not 
throwing exception by default when copying null values.

> [beanutils] copyProperties() throws a ConversionException :  No value 
> specified for 'Date' when the field is a java.util.Date with a null value
> -----------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: BEANUTILS-387
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-387
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils
>    Affects Versions: 1.8.3
>            Reporter: Daniel Marchese
>
> We have migrated the library from version 1.6.0 to 1.8.0 and the 
> copyProperties() method fails when copying a java.util.Date attribute with a 
> null value.
> Here is a simple testcase :
> {code}
> public class Test {
>       private Date date;
>       
>       public Date getDate() { return date;    }
>       public void setDate(Date date) { this.date = date; }
>       public static void main(String[] args) throws Exception {
>               Test dest = new Test();
>               Test source = new Test();
>               BeanUtils.copyProperties(dest, source);
>       }
> }
> {code}
> As a workaround, we can do this :
> ConvertUtils.register(new DateConverter(null), Date.class);
> When can also use PropertyUtils.copyProperties() because in this case no 
> conversion is required but the impact is unknown on our big application.
> The problem is that there seems to be a regression between version 1.6.0 and 
> 1.8.0.



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

Reply via email to