struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kirk Rasmussen (JIRA)" <j...@apache.org>
Subject [jira] Created: (WW-2825) StaticParametersInterceptor calls setters twice within interceptor code
Date Thu, 02 Oct 2008 18:19:25 GMT
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.


Mime
View raw message