struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johan Ström (JIRA) <j...@apache.org>
Subject [jira] [Commented] (WW-4066) Submitting form with parameters using brackets while devMode=true yields StringIndexOutOfBoundsException
Date Tue, 28 May 2013 07:22:24 GMT

    [ https://issues.apache.org/jira/browse/WW-4066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13668142#comment-13668142
] 

Johan Ström commented on WW-4066:
---------------------------------

Found it.

In ParametersInterceptor, the acceptParamNames config element is used in two places on each
interception: 
* to fill up acceptableParameters. This is based on both acceptParamNames config, AND any
ParameterNameAware's acceptableParameterName(Strings) method.
* to setAcceptProperties on the MemberAccessValueStack. This ONLY uses the acceptParamNames
config.

My problem occurs if acceptParamNames config rejects a param, but acceptableParameterName(String)
accepts it. The ParameterInterceptor will go try to set the value on the stack (since it was
accepted by the ParameterNameAware), but the stack will reject it since setAcceptProperites
is based on acceptParamNames only.

Not sure what the proper fix here is, but at least it explains the problem I'm having.
                
> Submitting form with parameters using brackets while devMode=true yields StringIndexOutOfBoundsException
> --------------------------------------------------------------------------------------------------------
>
>                 Key: WW-4066
>                 URL: https://issues.apache.org/jira/browse/WW-4066
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.3.14
>            Reporter: Chris Cranford
>            Assignee: Lukasz Lenart
>             Fix For: 2.3.16
>
>         Attachments: testcase.zip
>
>
> Our BaseAction which extends ActionSupport overrides the addActionMessage() with the
following:
> {code:java}
> @Override
> public void addActionMessage(String message) {
>   super.addActionMessage(getText(message));
> }
> {code}
> With the above method in place during devMode=true, the following error stack trace occurs:
> {noformat}
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
>   at java.lang.String.substring(String.java:1871)
>   at com.opensymphony.xwork2.util.LocalizedTextUtil.findText(LocalizedTextUtil.java:426)
>   at com.opensymphony.xwork2.util.LocalizedTextUtil.findText(LocalizedTextUtil.java:362)
>   at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:208)
>   at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:123)
>   at com.opensymphony.xwork2.ActionSupport.getText(ActionSupport.java:103)
>   at com.setech.dw.common.web.BaseAction.addActionMessage(BaseAction.java:209)
>   at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:337)
>   at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:241)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message