[ https://issues.apache.org/jira/browse/WW-3762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart resolved WW-3762. ------------------------------- Resolution: Fixed Solved, thanks for the 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 > Assignee: Lukasz Lenart > Labels: patch > Fix For: 2.3.2 > > Attachments: WW-3762.diff, WW-3762.patch, example.txt > > > 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