struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject svn commit: r1519588 - in /struts/struts2/trunk/xwork-core/src: main/java/com/opensymphony/xwork2/config/impl/ main/java/com/opensymphony/xwork2/ognl/ test/java/com/opensymphony/xwork2/ognl/
Date Tue, 03 Sep 2013 07:37:04 GMT
Author: lukaszlenart
Date: Tue Sep  3 07:37:04 2013
New Revision: 1519588

URL: http://svn.apache.org/r1519588
Log:
WW-4186 Removes static and uses instance value to set enableExpressionCache constant

Modified:
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/MockConfiguration.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java?rev=1519588&r1=1519587&r2=1519588&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
(original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
Tue Sep  3 07:37:04 2013
@@ -335,6 +335,7 @@ public class DefaultConfiguration implem
         builder.constant(XWorkConstants.DEV_MODE, "false");
         builder.constant(XWorkConstants.LOG_MISSING_PROPERTIES, "false");
         builder.constant(XWorkConstants.ENABLE_OGNL_EVAL_EXPRESSION, "false");
+        builder.constant(XWorkConstants.ENABLE_OGNL_EXPRESSION_CACHE, "true");
         builder.constant(XWorkConstants.RELOAD_XML_CONFIGURATION, "false");
         return builder.create(true);
     }

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/MockConfiguration.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/MockConfiguration.java?rev=1519588&r1=1519587&r2=1519588&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/MockConfiguration.java
(original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/MockConfiguration.java
Tue Sep  3 07:37:04 2013
@@ -59,6 +59,7 @@ public class MockConfiguration implement
         new XWorkConfigurationProvider().register(builder, props);
         builder.constant(XWorkConstants.DEV_MODE, "false");
         builder.constant(XWorkConstants.RELOAD_XML_CONFIGURATION, "true");
+        builder.constant(XWorkConstants.ENABLE_OGNL_EXPRESSION_CACHE, "true");
         container = builder.create(true);
     }
 

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java?rev=1519588&r1=1519587&r2=1519588&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
(original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
Tue Sep  3 07:37:04 2013
@@ -52,10 +52,10 @@ public class OgnlUtil {
     private static final Logger LOG = LoggerFactory.getLogger(OgnlUtil.class);
     private ConcurrentMap<String, Object> expressions = new ConcurrentHashMap<String,
Object>();
     private final ConcurrentMap<Class, BeanInfo> beanInfoCache = new ConcurrentHashMap<Class,
BeanInfo>();
-
     private TypeConverter defaultConverter;
-    static boolean devMode = false;
-    static boolean enableExpressionCache = true;
+
+    private boolean devMode = false;
+    private boolean enableExpressionCache = true;
     private boolean enableEvalExpression;
 
     @Inject
@@ -64,12 +64,12 @@ public class OgnlUtil {
     }
 
     @Inject(XWorkConstants.DEV_MODE)
-    public static void setDevMode(String mode) {
+    public void setDevMode(String mode) {
         devMode = "true".equals(mode);
     }
 
     @Inject(XWorkConstants.ENABLE_OGNL_EXPRESSION_CACHE)
-    public static void setEnableExpressionCache(String cache) {
+    public void setEnableExpressionCache(String cache) {
        enableExpressionCache = "true".equals(cache);
     }
 
@@ -464,10 +464,8 @@ public class OgnlUtil {
 
             if (throwPropertyExceptions) {
                 throw new ReflectionException(msg, exception);
-            } else {
-                if (devMode) {
-                    LOG.warn(msg, exception);
-                }
+            } else if (devMode) {
+                LOG.warn(msg, exception);
             }
         }
     }

Modified: struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java?rev=1519588&r1=1519587&r2=1519588&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java
(original)
+++ struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java
Tue Sep  3 07:37:04 2013
@@ -92,14 +92,14 @@ public class OgnlUtilTest extends XWorkT
     }
 
     public void testCacheEnabled() throws OgnlException {
-        OgnlUtil.setEnableExpressionCache("true");
+        ognlUtil.setEnableExpressionCache("true");
         Object expr0 = ognlUtil.compile("test");
         Object expr2 = ognlUtil.compile("test");
         assertSame(expr0, expr2);
     }
 
      public void testCacheDisabled() throws OgnlException {
-        OgnlUtil.setEnableExpressionCache("false");
+        ognlUtil.setEnableExpressionCache("false");
         Object expr0 = ognlUtil.compile("test");
         Object expr2 = ognlUtil.compile("test");
         assertNotSame(expr0, expr2);



Mime
View raw message