You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Pelladi Gabor (Updated) (JIRA)" <ji...@apache.org> on 2012/02/22 12:57:48 UTC

[jira] [Updated] (WW-3762) XWorkBasicConverter doConvertToCollection causes ClassCastException if an item cannot be converted

     [ https://issues.apache.org/jira/browse/WW-3762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pelladi Gabor updated WW-3762:
------------------------------

    Attachment: WW-3762.diff

Patch
                
> XWorkBasicConverter doConvertToCollection causes ClassCastException if an item cannot be converted
> --------------------------------------------------------------------------------------------------
>
>                 Key: WW-3762
>                 URL: https://issues.apache.org/jira/browse/WW-3762
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Value Stack
>    Affects Versions: 2.3.1.2
>            Reporter: Pelladi Gabor
>              Labels: patch
>         Attachments: WW-3762.diff
>
>
> My action has a property of type List<Integer> (same for other non-string types). The action will later iterate over this property, and it gets a ClassCastException, because the list (of type List<Integer>) contains a String.
> It is because XWorkBasicConverter.doConvertToCollection() converts the input string array into an integer list. But if the input coming from the browser contains a value that cannot be converted to a string, then the string "ognl.NoConversionPossible" is put into the list. It is wrong, we should pay attention to the type of the list.
> I have attached a patch that does not put elements into the list that cannot be converted.
> I have also attached a file that contains a simple example for this bug.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira