struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johan Ström (JIRA) <>
Subject [jira] [Commented] (WW-4066) Submitting form with parameters using brackets while devMode=true yields StringIndexOutOfBoundsException
Date Mon, 27 May 2013 15:26:22 GMT


Johan Ström commented on WW-4066:


I'd like to report that I have similar problems with
My action implements both ParameterAware and ParameterNameAware, and accepts a set of params
via setters. With the WW-3973 change, this now allows setting of a lot of other parameters
(if it is an "acceptable name" OR allowed by acceptableParameterName() it is let through).
To avoid this and only really allow the ones I want, I tried this in the interceptor stack:

<interceptor-ref name="params">
<param name="acceptParamNames">ThisIsNotARealParameter_BUT_It_must_be_set_to_work</param>

If the value is blank the acceptParamNames are not even regarded, so I put a dummy value there..

This however results in failure to set even basic Strings:

public void setSort(String sort)

A simple call to ?simpleparam=abc&sort=name results in this:

ERROR (com.opensymphony.xwork2.interceptor.ParametersInterceptor:38) - Developer Notification
(set struts.devMode to false to disable this message):
Unexpected Exception caught setting 'sort' on 'class com.myapp.MyActionClass: Error setting
expression 'sort' with value ['name', ]
Error setting expression 'sort' with value ['name', ] - [unknown location]

I do NOT get an error for the simpleparam, which is not OK'ed by the acceptableParamNames()
method so that is not expected. But for the simple 'sort' parameter, it refuses to work..
If I remove the acceptParamNames setting, everything works as expected.

> Submitting form with parameters using brackets while devMode=true yields StringIndexOutOfBoundsException
> --------------------------------------------------------------------------------------------------------
>                 Key: WW-4066
>                 URL:
>             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:
> Our BaseAction which extends ActionSupport overrides the addActionMessage() with the
> {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(
>   at com.opensymphony.xwork2.util.LocalizedTextUtil.findText(
>   at com.opensymphony.xwork2.util.LocalizedTextUtil.findText(
>   at com.opensymphony.xwork2.TextProviderSupport.getText(
>   at com.opensymphony.xwork2.TextProviderSupport.getText(
>   at com.opensymphony.xwork2.ActionSupport.getText(
>   at com.setech.dw.common.web.BaseAction.addActionMessage(
>   at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(
>   at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(
> {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:

View raw message