Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4066

Submitting form with parameters using brackets while devMode=true yields StringIndexOutOfBoundsException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.14
    • Fix Version/s: 2.3.16
    • Component/s: Core Actions
    • Labels:
      None

      Description

      Our BaseAction which extends ActionSupport overrides the addActionMessage() with the following:

      @Override
      public void addActionMessage(String message) {
        super.addActionMessage(getText(message));
      }
      

      With the above method in place during devMode=true, the following error stack trace occurs:

      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)
      

        Attachments

        1. ParametersInterceptor.java
          6 kB
          Johno Crawford
        2. testcase.zip
          6.72 MB
          Chris Cranford

          Activity

            People

            • Assignee:
              lukaszlenart Lukasz Lenart
              Reporter:
              crancran Chris Cranford
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: