You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Hudson (Commented) (JIRA)" <ji...@apache.org> on 2012/03/06 08:02:59 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=13223041#comment-13223041 ] 

Hudson commented on WW-3762:
----------------------------

Integrated in Struts2 #425 (See [https://builds.apache.org/job/Struts2/425/])
    WW-3762 - extracts one huge converter into smaller classes and implements better conversion mechanism for collections (Revision 1297347)

     Result = SUCCESS
lukaszlenart : 
Files : 
* /struts/struts2/trunk/core/src/main/resources/struts-default.xml
* /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ObjectFactory.java
* /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
* /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
* /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/ArrayConverter.java
* /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/CollectionConverter.java
* /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/DateConverter.java
* /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/DefaultTypeConverter.java
* /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/NumberConverter.java
* /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/StringConverter.java
* /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkBasicConverter.java
* /struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/conversion/impl/XWorkBasicConverterTest.java
* /struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/conversion/impl/XWorkConverterTest.java

                
> 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