commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton (JIRA)" <>
Subject [jira] Resolved: (BEANUTILS-183) [beanutils] Problem with index property
Date Sun, 20 May 2007 09:28:16 GMT


Niall Pemberton resolved BEANUTILS-183.

    Resolution: Invalid

> [beanutils] Problem with index property
> ---------------------------------------
>                 Key: BEANUTILS-183
>                 URL:
>             Project: Commons BeanUtils
>          Issue Type: Improvement
>          Components: Bean / Property Utils
>         Environment: Operating System: All
> Platform: PC
>            Reporter: Laura Misciagna
>            Priority: Minor
>             Fix For: 1.8.0
> I have changed the PropertyUtils in the public static void setIndexedProperty
> (Object bean, String name, int index, Object value)method I have added the 
> following code because I have a null pointer exception the array is null.
> if (array != null)  // CODE ADDED
> if(!array.getClass().isArray()){
>   if(array instanceof List) ((List)array).set(index, value);
>   else throw new IllegalArgumentException("Property '" + name + "' is not 
> indexed");
>   } else {Array.set(array, index, value);}
> Now I try to explain because I have this exception, I have a Form Bean A with a 
> property that is an array in this array are stored the index of selected row in 
> the table so when the rows are selected if I go to another form bean B by using 
> a forward to another action mapping. Also this new bean has the same property 
> of A but the array is not initialized and of couse will have different size. So 
> when Struts tries to populate the form bean B found the parm in the request and 
> try to initialize the property of B (but in my case is wrong) so it has a null 
> pointer exception.
> If I add the check if the array is null the problem is solved.
> Could you ask me if you want introduce my fix in your code.
> The version of Struts tah I use it is that shipped with WSAD v. 5.

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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message