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

Leo Woessner commented on BEANUTILS-107:
----------------------------------------

The BeanUtils.copyProperties exhibits this behavior.  I am using BeanUtils to 
copy DTOs to Hibernate objects and back.  The ID is a Long and creating a zero 
from null is very problematic.  I do not see the 2 agrument constructor for 
BeanUtils in 1.8.0.  Can you suggest a way to work around this, besides hand 
processing the conversion. 

I believe this is not good behavior because null != 0;



> ConvertUtils changes long standing default conversions from null to zero
> ------------------------------------------------------------------------
>
>                 Key: BEANUTILS-107
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-107
>             Project: Commons BeanUtils
>          Issue Type: Bug
>    Affects Versions: Nightly Builds
>         Environment: Operating System: other
> Platform: All
>            Reporter: Hal Deadman
>            Priority: Critical
>
> The addition of pluggable converters in ConvertUtils on 3/18 has changed the
> default conversion for Long, Integer, Double etc. from null to zero. The 
> default has been null since the before beanutils was in commons if I am not 
> mistaken. 
> This is a significant problem because it's not backwards compatible
> with Struts 1.0. People probably came to rely on things like empty string 
> converting to null rather than zero. 
> Also, the current set of converters doesn't accept null as a legal default
> value. If the default is set to null then an exception is thrown when the
> conversion fails. There should at least be a way to make the various provided 
> converters accept null as default without having to code a new set of 
> converters.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to