[
https://issues.apache.org/jira/browse/WW-4066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13666630#comment-13666630
]
Chris Cranford commented on WW-4066:
------------------------------------
bq. So I understand your point about needing to somehow alter the
'paramsPrepareParamsStack' but the default stack seems to work as intended.
I'll have to check why we chose to use that particular interceptor stack rather
than the default.
In reviewing the struts-default XML configuration, I see specifically why we
opted for the {{paramsPrepareParamsStack}}. It's been several years since we
started the foundation on this application and so I had forgotten the reasons
for my decision :).
A majority of our existing {{ModelDriven<T>}} actions inspect a set of
submitted values and based on those values, determine how the model is to be
instantiated. That was the real benefit of this particular interceptor stack
for our application's design because it allowed us to set properties on the
action for those specific submitted values, do whatever logic inside
{{prepare()}} was necessary for the model's allocation, and then the second
parameters interceptor invocation populated the model accordingly.
The old way this interceptor stack worked with parameters had little
assumptions since parameters could technically exist on the action, model, or a
combination of both. I understand the reason to prompt the developer with a
warning if the property doesn't exist on the action or the model, but if it
exists on at least one of them, I don't believe a developer warning message
makes sense in this use case.
> 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