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

Benedikt Ritter commented on BEANUTILS-400:
-------------------------------------------

Hi smildlzj,

the exception thrown indicates what is wrong:
{code}
java.lang.IllegalArgumentException: Indexed or mapped properties are not 
supported on objects of type Map: mapProperty(mappedArray)
        at 
org.apache.commons.beanutils.PropertyUtilsBean.getPropertyOfMapBean(PropertyUtilsBean.java:813)
        at 
org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:764)
        at 
org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:846)
        at 
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:426)
{code}
PropertyUtils does not support this kind of access on Maps (yet). If you want 
you can create a SVN patch for this. We can then include it in the next 
release. Because PropertyUtils produces a failure that tells users what is 
wrong, this doesn't have the highest prio ;-)

Regards,
Benedikt

                
> set get Array in map fail?
> --------------------------
>
>                 Key: BEANUTILS-400
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-400
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils
>         Environment: jdk1.6
>            Reporter: smildlzj
>
> i have test case like as follow,but was fail!any problem?
> public static void testGetMappedArray() throws Exception {
>       String[] array = new String[] {"abc", "def", "ghi"};
>       Map s1=new HashMap();
>               Map s2=new HashMap();
>               s1.put("mapProperty", s2);
>               s2.put("mappedArray", array);
>         
>         assertEquals("abc", PropertyUtil.getProperty(s1, 
> "mapProperty(mappedArray)[0]"));
>         assertEquals("def", PropertyUtil.getProperty(s1, 
> "mapProperty(mappedArray)[1]"));
>         assertEquals("ghi", PropertyUtil.getProperty(s1, 
> "mapProperty(mappedArray)[2]"));
>         
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to