You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Ivan Rei (JIRA)" <ji...@apache.org> on 2008/03/24 19:14:58 UTC
[jira] Created: (WW-2564) Type Conversion of List not
working when list is empty.
Type Conversion of List<Integer> not working when list is empty.
----------------------------------------------------------------
Key: WW-2564
URL: https://issues.apache.org/struts/browse/WW-2564
Project: Struts 2
Issue Type: Bug
Affects Versions: 2.0.11.1
Environment: Windows XP
Reporter: Ivan Rei
When using a object of type List<Integer>, and that object comes empty from the JSP, you get a conversion error. Eg. Have 2 lists of checkboxes on the JSP. One is a List<String> and the other is List<Integer>, if I don't select any of the checkboxes of either type, I get a validation error (xwork.default.invalid.fieldvalue) on the integer list only. If I remove the integer list from the JSP, I get to the action.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (WW-2564) Type Conversion of List not
working when list is empty.
Posted by "Rainer Hermanns (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rainer Hermanns resolved WW-2564.
---------------------------------
Resolution: Fixed
Assignee: Rainer Hermanns
This issue seems to be resolved by Don's patch in rev655721.
Please verify with latest s2.1 from trunk.
> Type Conversion of List<Integer> not working when list is empty.
> ----------------------------------------------------------------
>
> Key: WW-2564
> URL: https://issues.apache.org/struts/browse/WW-2564
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.0.11.1
> Environment: Windows XP
> Reporter: Ivan Rei
> Assignee: Rainer Hermanns
> Fix For: 2.1.3
>
>
> When using a object of type List<Integer>, and that object comes empty from the JSP, you get a conversion error. Eg. Have 2 lists of checkboxes on the JSP. One is a List<String> and the other is List<Integer>, if I don't select any of the checkboxes of either type, I get a validation error (xwork.default.invalid.fieldvalue) on the integer list only. If I remove the integer list from the JSP, I get to the action.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WW-2564) Type Conversion of List not
working when list is empty.
Posted by "Don Brown (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Don Brown updated WW-2564:
--------------------------
Fix Version/s: 2.1.3
> Type Conversion of List<Integer> not working when list is empty.
> ----------------------------------------------------------------
>
> Key: WW-2564
> URL: https://issues.apache.org/struts/browse/WW-2564
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.0.11.1
> Environment: Windows XP
> Reporter: Ivan Rei
> Fix For: 2.1.3
>
>
> When using a object of type List<Integer>, and that object comes empty from the JSP, you get a conversion error. Eg. Have 2 lists of checkboxes on the JSP. One is a List<String> and the other is List<Integer>, if I don't select any of the checkboxes of either type, I get a validation error (xwork.default.invalid.fieldvalue) on the integer list only. If I remove the integer list from the JSP, I get to the action.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WW-2564) Type Conversion of List not
working when list is empty.
Posted by "Ivan Rei (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43544#action_43544 ]
Ivan Rei commented on WW-2564:
------------------------------
This happens because of the Checkbox Interceptor. I created a new checkbox.ftl without the hidden. Like that it doesn't execute the Interceptor. Problem resolved.
> Type Conversion of List<Integer> not working when list is empty.
> ----------------------------------------------------------------
>
> Key: WW-2564
> URL: https://issues.apache.org/struts/browse/WW-2564
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.0.11.1
> Environment: Windows XP
> Reporter: Ivan Rei
>
> When using a object of type List<Integer>, and that object comes empty from the JSP, you get a conversion error. Eg. Have 2 lists of checkboxes on the JSP. One is a List<String> and the other is List<Integer>, if I don't select any of the checkboxes of either type, I get a validation error (xwork.default.invalid.fieldvalue) on the integer list only. If I remove the integer list from the JSP, I get to the action.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WW-2564) Type Conversion of List not
working when list is empty.
Posted by "Greg Lindholm (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43565#action_43565 ]
Greg Lindholm commented on WW-2564:
-----------------------------------
Did a little debugging and I think the problem is in the CheckboxInterceptor.
It's creating a new param to handle the not checked case, this isn't correct if we have an array of checkboxes.
I think it needs to check if the parameter "__checkbox_xxx" value is an array with size > 1 it should not create the new 'false' param.
If I can make this work I will submit the patch.
> Type Conversion of List<Integer> not working when list is empty.
> ----------------------------------------------------------------
>
> Key: WW-2564
> URL: https://issues.apache.org/struts/browse/WW-2564
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.0.11.1
> Environment: Windows XP
> Reporter: Ivan Rei
>
> When using a object of type List<Integer>, and that object comes empty from the JSP, you get a conversion error. Eg. Have 2 lists of checkboxes on the JSP. One is a List<String> and the other is List<Integer>, if I don't select any of the checkboxes of either type, I get a validation error (xwork.default.invalid.fieldvalue) on the integer list only. If I remove the integer list from the JSP, I get to the action.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WW-2564) Type Conversion of List not
working when list is empty.
Posted by "Greg Lindholm (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43564#action_43564 ]
Greg Lindholm commented on WW-2564:
-----------------------------------
I'm having this problem as well. (I don't think Ivan's solution will work in the general case.)
I'm displaying a list of checkboxes for account names:
<s:iterator value="accountInfoList" status="accountInfoStatus">
<s:checkbox name="accountIds" label="%{name}" value="%{enabled}" fieldValue="%{id}" />
</s:iterator>
It then sets the array of selected account ids.
public void setAccountIds(Long[] accountIds)...
This works fine as long as at least one checkbox was selected.
If no checkboxes are selected then I get:
ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'accountIds' on 'class com.xyz.struts.MyAction: Error setting expression 'accountIds' with value 'false'
It appears that if none are selected it doesn't realize it's dealing with an array so attempts to set it as a simple boolean 'false'.
I attempted to work-around this by adding overload method "public void setAccountIds(Boolean none)...". This didn't work, got the same error.
> Type Conversion of List<Integer> not working when list is empty.
> ----------------------------------------------------------------
>
> Key: WW-2564
> URL: https://issues.apache.org/struts/browse/WW-2564
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.0.11.1
> Environment: Windows XP
> Reporter: Ivan Rei
>
> When using a object of type List<Integer>, and that object comes empty from the JSP, you get a conversion error. Eg. Have 2 lists of checkboxes on the JSP. One is a List<String> and the other is List<Integer>, if I don't select any of the checkboxes of either type, I get a validation error (xwork.default.invalid.fieldvalue) on the integer list only. If I remove the integer list from the JSP, I get to the action.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.