You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stephen Leung (JIRA)" <ji...@apache.org> on 2007/09/03 17:56:59 UTC

[jira] Created: (BEANUTILS-294) BeanUtilsBean.setProperty() does not support nested map

BeanUtilsBean.setProperty() does not support nested map
-------------------------------------------------------

                 Key: BEANUTILS-294
                 URL: https://issues.apache.org/jira/browse/BEANUTILS-294
             Project: Commons BeanUtils
          Issue Type: Bug
          Components: Bean / Property Utils
    Affects Versions: 1.8.0-BETA
            Reporter: Stephen Leung
            Priority: Critical


I tried to call BeanUtilsBean.setProperty() with a DynaActionForm as the "bean" and "someMap(x)(y)" as the "name". In BeanUtilsBean.setProperty(), after the while loop at line 900, target became "null" and name became = "(y)". And consequently IllegalArgumentException is thrown at line 930 when setProperty() tried to getPropertyDescriptor() of a null bean. Specifically, the following is the stack trace. Could somebody look into it?

Thanks.

java.lang.IllegalArgumentException: No bean specified
     at org.apache.common.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:871)
     at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:930)
     at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:829)
     at org.apache.commons.beanutils.BeanUtils.populate(BeanUtilsBean.java:433)
     at org.apache.struts.util.RequestUtils.pouplate(RequestUtils.java:467)
    ......





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


[jira] Commented: (BEANUTILS-294) BeanUtilsBean.setProperty() does not support nested map

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BEANUTILS-294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525106 ] 

Niall Pemberton commented on BEANUTILS-294:
-------------------------------------------

There is a test case for setting a nested mapped property:

http://commons.apache.org/beanutils/xref-test/org/apache/commons/beanutils/PropertyUtilsTestCase.html#2954

So it looks to me like its working OK.

If your initial mapped property [i.e. someMap(x)] returns a null rather than a Map though this is the behaviour I would expect - and you resolve it by populating the Map before calling setProperty. If you want your Map's to be automatically created then you might want to look at using LazyActionForm / LazyDynaBean.

> BeanUtilsBean.setProperty() does not support nested map
> -------------------------------------------------------
>
>                 Key: BEANUTILS-294
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-294
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils
>    Affects Versions: 1.8.0-BETA
>            Reporter: Stephen Leung
>            Priority: Critical
>
> I tried to call BeanUtilsBean.setProperty() with a DynaActionForm as the "bean" and "someMap(x)(y)" as the "name". In BeanUtilsBean.setProperty(), after the while loop at line 900, target became "null" and name became = "(y)". And consequently IllegalArgumentException is thrown at line 930 when setProperty() tried to getPropertyDescriptor() of a null bean. Specifically, the following is the stack trace. Could somebody look into it?
> Thanks.
> java.lang.IllegalArgumentException: No bean specified
>      at org.apache.common.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:871)
>      at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:930)
>      at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:829)
>      at org.apache.commons.beanutils.BeanUtils.populate(BeanUtilsBean.java:433)
>      at org.apache.struts.util.RequestUtils.pouplate(RequestUtils.java:467)
>     ......

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


[jira] Resolved: (BEANUTILS-294) BeanUtilsBean.setProperty() does not support nested map

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BEANUTILS-294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton resolved BEANUTILS-294.
---------------------------------------

    Resolution: Fixed
      Assignee: Niall Pemberton

Fixed, thanks:

http://svn.apache.org/viewvc?view=rev&revision=640274

> BeanUtilsBean.setProperty() does not support nested map
> -------------------------------------------------------
>
>                 Key: BEANUTILS-294
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-294
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils
>    Affects Versions: 1.8.0-BETA
>            Reporter: Stephen Leung
>            Assignee: Niall Pemberton
>            Priority: Critical
>             Fix For: 1.8.0
>
>
> I tried to call BeanUtilsBean.setProperty() with a DynaActionForm as the "bean" and "someMap(x)(y)" as the "name". In BeanUtilsBean.setProperty(), after the while loop at line 900, target became "null" and name became = "(y)". And consequently IllegalArgumentException is thrown at line 930 when setProperty() tried to getPropertyDescriptor() of a null bean. Specifically, the following is the stack trace. Could somebody look into it?
> Thanks.
> java.lang.IllegalArgumentException: No bean specified
>      at org.apache.common.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:871)
>      at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:930)
>      at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:829)
>      at org.apache.commons.beanutils.BeanUtils.populate(BeanUtilsBean.java:433)
>      at org.apache.struts.util.RequestUtils.pouplate(RequestUtils.java:467)
>     ......

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


[jira] Updated: (BEANUTILS-294) BeanUtilsBean.setProperty() does not support nested map

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BEANUTILS-294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton updated BEANUTILS-294:
--------------------------------------

    Fix Version/s: 1.8.0

Yes you're right, I'll put this on the list for 1.8.0

> BeanUtilsBean.setProperty() does not support nested map
> -------------------------------------------------------
>
>                 Key: BEANUTILS-294
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-294
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils
>    Affects Versions: 1.8.0-BETA
>            Reporter: Stephen Leung
>            Priority: Critical
>             Fix For: 1.8.0
>
>
> I tried to call BeanUtilsBean.setProperty() with a DynaActionForm as the "bean" and "someMap(x)(y)" as the "name". In BeanUtilsBean.setProperty(), after the while loop at line 900, target became "null" and name became = "(y)". And consequently IllegalArgumentException is thrown at line 930 when setProperty() tried to getPropertyDescriptor() of a null bean. Specifically, the following is the stack trace. Could somebody look into it?
> Thanks.
> java.lang.IllegalArgumentException: No bean specified
>      at org.apache.common.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:871)
>      at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:930)
>      at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:829)
>      at org.apache.commons.beanutils.BeanUtils.populate(BeanUtilsBean.java:433)
>      at org.apache.struts.util.RequestUtils.pouplate(RequestUtils.java:467)
>     ......

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


[jira] Resolved: (BEANUTILS-294) BeanUtilsBean.setProperty() does not support nested map

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BEANUTILS-294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton resolved BEANUTILS-294.
---------------------------------------

    Resolution: Invalid

Closing this as INVALID as I assume the lack of further comment means it turned out to not be a BeanUtils issue. Please feel free to re-open if you have more info and still think its an issue.

> BeanUtilsBean.setProperty() does not support nested map
> -------------------------------------------------------
>
>                 Key: BEANUTILS-294
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-294
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils
>    Affects Versions: 1.8.0-BETA
>            Reporter: Stephen Leung
>            Priority: Critical
>
> I tried to call BeanUtilsBean.setProperty() with a DynaActionForm as the "bean" and "someMap(x)(y)" as the "name". In BeanUtilsBean.setProperty(), after the while loop at line 900, target became "null" and name became = "(y)". And consequently IllegalArgumentException is thrown at line 930 when setProperty() tried to getPropertyDescriptor() of a null bean. Specifically, the following is the stack trace. Could somebody look into it?
> Thanks.
> java.lang.IllegalArgumentException: No bean specified
>      at org.apache.common.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:871)
>      at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:930)
>      at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:829)
>      at org.apache.commons.beanutils.BeanUtils.populate(BeanUtilsBean.java:433)
>      at org.apache.struts.util.RequestUtils.pouplate(RequestUtils.java:467)
>     ......

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


[jira] Reopened: (BEANUTILS-294) BeanUtilsBean.setProperty() does not support nested map

Posted by "Stephen Leung (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BEANUTILS-294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Leung reopened BEANUTILS-294:
-------------------------------------


Just tried setting nested map property with BeanUtilsBean.setProperty() and it seemed it still doesn't support nested maps. The test case mentioned above (PropertyUtilsTestCase.testSetMappedMap()) works because it is using PropertyUtils, but not BeanUtils. If we replace PropertyUtils.setProperty() with BeanUtils.setProperty() in the unit test, then the unit test will fail.

It is important to make BeanUtils.setProperty() to support nested maps since it is used by Struts.


> BeanUtilsBean.setProperty() does not support nested map
> -------------------------------------------------------
>
>                 Key: BEANUTILS-294
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-294
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils
>    Affects Versions: 1.8.0-BETA
>            Reporter: Stephen Leung
>            Priority: Critical
>
> I tried to call BeanUtilsBean.setProperty() with a DynaActionForm as the "bean" and "someMap(x)(y)" as the "name". In BeanUtilsBean.setProperty(), after the while loop at line 900, target became "null" and name became = "(y)". And consequently IllegalArgumentException is thrown at line 930 when setProperty() tried to getPropertyDescriptor() of a null bean. Specifically, the following is the stack trace. Could somebody look into it?
> Thanks.
> java.lang.IllegalArgumentException: No bean specified
>      at org.apache.common.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:871)
>      at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:930)
>      at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:829)
>      at org.apache.commons.beanutils.BeanUtils.populate(BeanUtilsBean.java:433)
>      at org.apache.struts.util.RequestUtils.pouplate(RequestUtils.java:467)
>     ......

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