StaticParametersInterceptor calls setters twice within interceptor code
-----------------------------------------------------------------------

                 Key: WW-2825
                 URL: https://issues.apache.org/struts/browse/WW-2825
             Project: Struts 2
          Issue Type: Bug
          Components: Core Interceptors
    Affects Versions: 2.0.11.2
            Reporter: Kirk Rasmussen
            Priority: Minor


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);
            }



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to