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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.14
    • 2.3.16
    • Core Actions
    • 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. testcase.zip
          6.72 MB
          Chris Cranford
        2. ParametersInterceptor.java
          6 kB
          Johno Crawford

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: