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

StaticParametersInterceptor calls setters twice within interceptor code

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.11.2
    • 2.1.3
    • Core Interceptors
    • None

    Description

      com.opensymphony.xwork2.interceptor.StaticParametersInterceptor will currently call the setter twice for each static property. It looks like the intention was to call it with either the naked value or parse the value as an OGNL expression but currently it is calling the setter twice regardless, i.e.

      for (Iterator iterator = parameters.entrySet().iterator();
      iterator.hasNext() {
      Map.Entry entry = (Map.Entry) iterator.next();
      (1) stack.setValue(entry.getKey().toString(), entry.getValue());
      Object val = entry.getValue();
      if (parse && val instanceof String)

      { val = TextParseUtil.translateVariables((String) val, stack); }
      (2) stack.setValue(entry.getKey().toString(), val);
      }


      I believe the intention was:

      for (Iterator iterator = parameters.entrySet().iterator();
      iterator.hasNext() {
      Map.Entry entry = (Map.Entry) iterator.next();
      Object val = entry.getValue();
      if (parse && val instanceof String) { val = TextParseUtil.translateVariables((String) val, stack); }

      stack.setValue(entry.getKey().toString(), val);
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            blackbeltdev Kirk Rasmussen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: