WW-4146 caches only valid OGNL expressions, closes #12

Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/63de7730
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/63de7730
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/63de7730

Branch: refs/heads/feature/WW-4295-localization
Commit: 63de7730ee2be146e90227ed067ed108f4a2a534
Parents: 21ef4e3
Author: Lukasz Lenart <lukaszlen...@apache.org>
Authored: Wed Jun 18 10:33:21 2014 +0200
Committer: Lukasz Lenart <lukaszlen...@apache.org>
Committed: Wed Jun 18 10:33:21 2014 +0200

----------------------------------------------------------------------
 .../src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/63de7730/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
----------------------------------------------------------------------
diff --git 
a/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java 
b/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
index b0345fc..63c45fe 100644
--- a/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
+++ b/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
@@ -331,17 +331,17 @@ public class OgnlUtil {
             if (tree == null) {
                 tree = Ognl.parseExpression(expression);
                 checkEnableEvalExpression(tree, context);
-                expressions.putIfAbsent(expression, tree);
             }
         } else {
             tree = Ognl.parseExpression(expression);
             checkEnableEvalExpression(tree, context);
         }
 
-
         final T exec = task.execute(tree);
-        if(enableExpressionCache)
+        // if cache is enabled and it's a valid expression, puts it in
+        if(enableExpressionCache) {
             expressions.putIfAbsent(expression, tree);
+        }
         return exec;
     }
 

Reply via email to