commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Heger (JIRA)" <>
Subject [jira] [Commented] (CONFIGURATION-566) BeanHelper.createBean() can't support Map<> bean property loading from file
Date Wed, 19 Feb 2014 20:37:26 GMT


Oliver Heger commented on CONFIGURATION-566:

So there also seems to be a problem with BeanUtils: The {{isWriteable()}} method is not in
sync with {{setProperty()}}, and the documentation is obviously wrong, too.

My preferred solution would be to fix {{isWriteable()}} in BeanUtils. However, there is not
much activity on this component, and it is not likely that such a fix happens in a near future.
So changing the code in {{BeanHelper}} seems to be the option to go.

Can you verify that the tests still run after you have removed the {{isWriteable()}} call?

> BeanHelper.createBean() can't support Map<> bean property loading from file
> ---------------------------------------------------------------------------
>                 Key: CONFIGURATION-566
>                 URL:
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Type conversion
>    Affects Versions: 1.10
>            Reporter: Shen liang
> The issue is BeanUtils.setProperty() can support the java Map bean to set the (key, value)
entry. But the BeahHelper.initProperty() add 1 more PropertyUtils.isWriteable() check. While
this PropertyUtils.isWriteable() doesn't support java Map bean. 
> The check "PropertyUtils.isWriteable()" is quite redundant and unnecessary.
> Is it better to remove the check "PropertyUtils.isWriteable()" since the BeanUtils.setProperty()
has various ways to set the properties?
> {noformat}
> BeanHelper.createBean() 
>  -> DefaultBeanFactory.createBean()
>       -> DefaultBeanFactory.initBeanInstance()
>            -> BeanHelper.initBean()
>                 ->BeahHelper.initProperty()
>                    {
>                         if (!PropertyUtils.isWriteable(bean, propName))
>                         ...
>                         BeanUtils.setProperty(bean, propName, value);
>                    }
> {noformat}

This message was sent by Atlassian JIRA

View raw message