commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "dhaniag (JIRA)" <>
Subject [jira] [Commented] (BEANUTILS-473) Backward compatibility - copying null values to primitive types
Date Fri, 29 Jul 2016 11:58:20 GMT


dhaniag commented on BEANUTILS-473:

When we try to upgrade from 1.7 to 1.9.0 as part of jasper report library found some features
Test cases
1) Define  an Integer variable in Class1
       private Integer var1;
2)  Define  an int variable in Class2
       private int var1;
3) Create object of Class1 and then set the var1 as null 

4) Using copy properties copy the Class1 to Class2

Getting below error.
Exception in thread "main" java.lang.IllegalArgumentException: Cannot invoke Class1.setVar1
on bean class 'class Class1' - null - had objects of type "<null>" but expected signature

Any solution available? Please help.

Very Urgent

> Backward compatibility - copying null values to primitive types
> ---------------------------------------------------------------
>                 Key: BEANUTILS-473
>                 URL:
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils
>    Affects Versions: 1.9.2
>            Reporter: Sven Raddatz
>              Labels: IllegalArgumentException, backwards-compatibility, null-values
> Copying a NULL value to a primitve property in destination bean (e.g. boolean) was silently
ignored in BU 1.7.0. In 1.9.2 this is throwing an IllegalArgumentException. 
> Since converters are not executed when value is null there is no way to prevent this
behaviour, making it hard to migrate from 1.7.0 to 1.9.2. The only way to accomplish this
task is to switch from primitive to non-primitive types in all destination beans, which would
result in huge testing effort. 
> It would be nice to either have the possibility to use convertes to handle null values
with a valid default (e.g. null = false in case of boolean) or to globally have a switch for
a "silent / lenient mode" where any exceptions during copying are silently ignored. 

This message was sent by Atlassian JIRA

View raw message