[ 
http://issues.apache.org/jira/browse/MYFACES-583?page=comments#action_12331200 
] 

Ken Weiner commented on MYFACES-583:
------------------------------------

Is this related to http://issues.apache.org/jira/browse/MYFACES-154 ?  If it is 
the same fix, then 154 can be resolved as well.

> "Error during model data update" using selectManyCheckbox
> ---------------------------------------------------------
>
>          Key: MYFACES-583
>          URL: http://issues.apache.org/jira/browse/MYFACES-583
>      Project: MyFaces
>         Type: Bug
>   Components: Implementation
>     Versions: 1.1.1
>     Reporter: Peter Mahoney
>     Assignee: Bruno Aranda
>      Fix For: 1.1.1

>
> I have a selectManyCheckBox backed by an Integer array property. When the 
> form is submitted, I get an exception thrown when updating the model:
> Caused by: javax.servlet.jsp.el.ELException: Attempt to coerce a value of 
> type "[Ljava.lang.Object;" to type "[Ljava.lang.Integer;"
> It seems that the property is trying to be set with an Object array, rather 
> than Integer array.
> I have tracked the problem down to _SharedRendererUtils:
> ...
>         {
>             //Object array
>             int len = submittedValue.length;
>             Object[] convertedValues = new Object[len];
>             for (int i = 0; i < len; i++)
>             {
>                 convertedValues[i]
>                     = converter.getAsObject(facesContext, component, 
> submittedValue[i]);
>             }
>             return convertedValues;
>         }
> ..
> Given that we know what type the array should be, a suggested patch for the 
> code is:
>             int len = submittedValue.length;
>             ArrayList convertedValues = new ArrayList(len);
>             for (int i = 0; i < len; i++)
>             {
>                 convertedValues.add(i, converter.getAsObject(facesContext, 
> component, submittedValue[i]));
>             }
>             
>             return convertedValues.toArray((Object[]) 
> Array.newInstance(arrayComponentType, len));
> Peter

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to