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

Bryan Helm commented on BEANUTILS-35:
-------------------------------------

I'm using a patched version of BeanUtilsBean where the [0] is removed on line 
993 (v1.9.2). When copying a String array to an array type, it should just copy 
the array, but the code dereferences it with [0], wrongly. This causes an array 
property to be copied as the first element of the array instead of as the whole 
array. It does not necessarily cause the exception seen here (a two dimensional 
array can be dereferenced and copied to an array), This seems like a really 
obvious bug and not related to the bigger issues being discussed here. Am I 
missing something?

> Indexed properties with Array type cause IllegalArgumentException in 
> setProperty/populate
> -----------------------------------------------------------------------------------------
>
>                 Key: BEANUTILS-35
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-35
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils
>    Affects Versions: 1.7.0
>         Environment: Operating System: All
> Platform: All
>            Reporter: David Wood
>            Assignee: Niall Pemberton
>             Fix For: 2.0
>
>         Attachments: ASF.LICENSE.NOT.GRANTED--ArrayIndexedProperty.patch, 
> ASF.LICENSE.NOT.GRANTED--beanutils-indexed-arrays.patch, 
> BEANUTILS-35-PropertyUtilsBean-getPropertyType.patch
>
>
> If you attempt:
> public String[] getIndexedArrayProperty(int index)
> public void setIndexedArrayProperty(int index,String newvalue[])
> ...this will fail with an IllegalArgumentException in PropertyUtilsBean, 
> because
> setProperty will decide to store the first element of the newvalue array 
> rather
> than the whole array.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to