struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukasz Lenart (JIRA)" <>
Subject [jira] [Commented] (WW-4066) Submitting form with parameters using brackets while devMode=true yields StringIndexOutOfBoundsException
Date Mon, 20 May 2013 05:41:17 GMT


Lukasz Lenart commented on WW-4066:

The problem isn't related to {{ModelDriven}} but to order of interceptors in {{paramsPrepareParamsStack}}
and the mentioned warning is just in {{devMode}} to alert developer that something potentially
can be wrong.

If you take a look on {{paramsPrepareParamsStack}} you will spot that the {{params}} interceptor
is listed two times -  before and after {{prepare}}, but there is also {{modelDriven}} listed
just before the second {{params}} which will put non-null {{Model}} onto stack.

The mentioned warnings come from the first {{params}} as action doesn't have appropriate setters
and {{Model}} wasn't yet put onto stack. Even if you add additional {{modelDriven}} interceptor
before the first {{params}}, model still won't be on the stack as it is null. That's why I
have suggested to create a dedicated interceptor to solve that uncommon situation or move
logic to create {{Model}} into {{getModel()}} method.

Or leave everything as is as it's just a warning in {{devMode}} ;-)
> 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.15
>         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