This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch WW-4792-constants-cleanup
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 5c9299b9c4461d8b049e61c67a8bba25d72dbb70
Author: Lukasz Lenart <[email protected]>
AuthorDate: Sat Jan 1 12:35:15 2022 +0100

    WW-4792 Uses proper names for constants
---
 apps/rest-showcase/pom.xml                         |  6 ----
 .../xwork2/config/impl/DefaultConfiguration.java   |  4 +--
 .../xwork2/config/impl/MockConfiguration.java      |  2 +-
 .../StrutsDefaultConfigurationProvider.java        |  4 +--
 .../com/opensymphony/xwork2/ognl/OgnlUtil.java     |  6 ++--
 .../java/org/apache/struts2/StrutsConstants.java   | 36 ++++++++++++++++------
 .../struts2/config/entities/ConstantConfig.java    | 14 ++++-----
 7 files changed, 42 insertions(+), 30 deletions(-)

diff --git a/apps/rest-showcase/pom.xml b/apps/rest-showcase/pom.xml
index 9aff868..9264dcd 100644
--- a/apps/rest-showcase/pom.xml
+++ b/apps/rest-showcase/pom.xml
@@ -114,12 +114,6 @@
                 <configuration>
                     <stopKey>CTRL+C</stopKey>
                     <stopPort>8999</stopPort>
-                    <systemProperties>
-                        <systemProperty>
-                            <name>xwork.loggerFactory</name>
-                            
<value>com.opensymphony.xwork2.util.logging.log4j2.Log4j2LoggerFactory</value>
-                        </systemProperty>
-                    </systemProperties>
                     <scanIntervalSeconds>10</scanIntervalSeconds>
                     
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
                     <webAppConfig>
diff --git 
a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
 
b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
index bfbec00..6db3139 100644
--- 
a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
+++ 
b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
@@ -285,8 +285,8 @@ public class DefaultConfiguration implements Configuration {
 
         builder.constant(StrutsConstants.STRUTS_DEVMODE, "false");
         builder.constant(StrutsConstants.STRUTS_OGNL_LOG_MISSING_PROPERTIES, 
"false");
-        builder.constant(StrutsConstants.STRUTS_ENABLE_OGNL_EVAL_EXPRESSION, 
"false");
-        builder.constant(StrutsConstants.STRUTS_ENABLE_OGNL_EXPRESSION_CACHE, 
"true");
+        builder.constant(StrutsConstants.STRUTS_OGNL_ENABLE_EVAL_EXPRESSION, 
"false");
+        builder.constant(StrutsConstants.STRUTS_OGNL_ENABLE_EXPRESSION_CACHE, 
"true");
         builder.constant(StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD, 
"false");
         builder.constant(StrutsConstants.STRUTS_I18N_RELOAD, "false");
 
diff --git 
a/core/src/main/java/com/opensymphony/xwork2/config/impl/MockConfiguration.java 
b/core/src/main/java/com/opensymphony/xwork2/config/impl/MockConfiguration.java
index 997c5f1..3305bca 100644
--- 
a/core/src/main/java/com/opensymphony/xwork2/config/impl/MockConfiguration.java
+++ 
b/core/src/main/java/com/opensymphony/xwork2/config/impl/MockConfiguration.java
@@ -53,7 +53,7 @@ public class MockConfiguration implements Configuration {
         new StrutsDefaultConfigurationProvider().register(builder, props);
         builder.constant(StrutsConstants.STRUTS_DEVMODE, "false");
         builder.constant(StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD, 
"true");
-        builder.constant(StrutsConstants.STRUTS_ENABLE_OGNL_EXPRESSION_CACHE, 
"true");
+        builder.constant(StrutsConstants.STRUTS_OGNL_ENABLE_EXPRESSION_CACHE, 
"true");
         
builder.constant(StrutsConstants.STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION, 
"false");
         container = builder.create(true);
     }
diff --git 
a/core/src/main/java/com/opensymphony/xwork2/config/providers/StrutsDefaultConfigurationProvider.java
 
b/core/src/main/java/com/opensymphony/xwork2/config/providers/StrutsDefaultConfigurationProvider.java
index 4a39a33..400674d 100644
--- 
a/core/src/main/java/com/opensymphony/xwork2/config/providers/StrutsDefaultConfigurationProvider.java
+++ 
b/core/src/main/java/com/opensymphony/xwork2/config/providers/StrutsDefaultConfigurationProvider.java
@@ -224,8 +224,8 @@ public class StrutsDefaultConfigurationProvider implements 
ConfigurationProvider
         props.setProperty(StrutsConstants.STRUTS_I18N_RELOAD, 
Boolean.FALSE.toString());
         props.setProperty(StrutsConstants.STRUTS_DEVMODE, 
Boolean.FALSE.toString());
         props.setProperty(StrutsConstants.STRUTS_OGNL_LOG_MISSING_PROPERTIES, 
Boolean.FALSE.toString());
-        props.setProperty(StrutsConstants.STRUTS_ENABLE_OGNL_EXPRESSION_CACHE, 
Boolean.TRUE.toString());
-        props.setProperty(StrutsConstants.STRUTS_ENABLE_OGNL_EVAL_EXPRESSION, 
Boolean.FALSE.toString());
+        props.setProperty(StrutsConstants.STRUTS_OGNL_ENABLE_EXPRESSION_CACHE, 
Boolean.TRUE.toString());
+        props.setProperty(StrutsConstants.STRUTS_OGNL_ENABLE_EVAL_EXPRESSION, 
Boolean.FALSE.toString());
         props.setProperty(StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD, 
Boolean.FALSE.toString());
         props.setProperty(StrutsConstants.STRUTS_ALLOW_STATIC_METHOD_ACCESS, 
Boolean.FALSE.toString());
         props.setProperty(StrutsConstants.STRUTS_ALLOW_STATIC_FIELD_ACCESS, 
Boolean.TRUE.toString());
diff --git a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java 
b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
index b891bce..007206c 100644
--- a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
+++ b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
@@ -98,12 +98,12 @@ public class OgnlUtil {
         this.devMode = BooleanUtils.toBoolean(mode);
     }
 
-    @Inject(StrutsConstants.STRUTS_ENABLE_OGNL_EXPRESSION_CACHE)
+    @Inject(StrutsConstants.STRUTS_OGNL_ENABLE_EXPRESSION_CACHE)
     protected void setEnableExpressionCache(String cache) {
         enableExpressionCache = BooleanUtils.toBoolean(cache);
     }
 
-    @Inject(value = StrutsConstants.STRUTS_ENABLE_OGNL_EVAL_EXPRESSION, 
required = false)
+    @Inject(value = StrutsConstants.STRUTS_OGNL_ENABLE_EVAL_EXPRESSION, 
required = false)
     protected void setEnableEvalExpression(String evalExpression) {
         this.enableEvalExpression = BooleanUtils.toBoolean(evalExpression);
         if (this.enableEvalExpression) {
@@ -566,7 +566,7 @@ public class OgnlUtil {
     public Object compile(String expression, Map<String, Object> context) 
throws OgnlException {
         return compileAndExecute(expression, context, tree -> tree);
     }
-    
+
     private void checkEnableEvalExpression(Object tree, Map<String, Object> 
context) throws OgnlException {
         if (!enableEvalExpression && isEvalExpression(tree, context)) {
             throw new OgnlException("Eval expressions/chained expressions have 
been disabled!");
diff --git a/core/src/main/java/org/apache/struts2/StrutsConstants.java 
b/core/src/main/java/org/apache/struts2/StrutsConstants.java
index 60007ce..a46653d 100644
--- a/core/src/main/java/org/apache/struts2/StrutsConstants.java
+++ b/core/src/main/java/org/apache/struts2/StrutsConstants.java
@@ -35,13 +35,13 @@ public final class StrutsConstants {
     /** The encoding to use for localization messages */
     public static final String STRUTS_I18N_ENCODING = "struts.i18n.encoding";
 
-    /** 
+    /**
      * Whether the default bundles should be searched for messages first.  Can 
be used to modify the
      * standard processing order for message lookup in TextProvider 
implementations.
      * <p>
      * Note: This control flag may not be meaningful to all provider 
implementations, and should be false by default.
      * </p>
-     * 
+     *
      * @since 2.6
      */
     public static final String STRUTS_I18N_SEARCH_DEFAULTBUNDLES_FIRST = 
"struts.i18n.search.defaultbundles.first";
@@ -104,10 +104,10 @@ public final class StrutsConstants {
 
     /** Update freemarker templates cache in seconds */
     public static final String STRUTS_FREEMARKER_TEMPLATES_CACHE_UPDATE_DELAY 
= "struts.freemarker.templatesCache.updateDelay";
-    
+
     /** Cache model instances at BeanWrapper level */
     public static final String STRUTS_FREEMARKER_BEANWRAPPER_CACHE = 
"struts.freemarker.beanwrapperCache";
-    
+
     /** Maximum strong sizing for MruCacheStorage for freemarker */
     public static final String STRUTS_FREEMARKER_MRU_MAX_STRONG_SIZE = 
"struts.freemarker.mru.max.strong.size";
 
@@ -188,7 +188,7 @@ public final class StrutsConstants {
      * You can specify different prefixes that will be handled by different 
mappers
      */
     public static final String PREFIX_BASED_MAPPER_CONFIGURATION = 
"struts.mapper.prefixMapping";
-    
+
     /** Whether the Struts filter should serve static content or not */
     public static final String STRUTS_SERVE_STATIC_CONTENT = 
"struts.serve.static";
 
@@ -262,11 +262,29 @@ public final class StrutsConstants {
     @Deprecated
     public static final String STRUTS_LOG_MISSING_PROPERTIES = 
STRUTS_OGNL_LOG_MISSING_PROPERTIES;
 
-    /** Enables caching of parsed OGNL expressions */
-    public static final String STRUTS_ENABLE_OGNL_EXPRESSION_CACHE = 
"struts.ognl.enableExpressionCache";
+    /**
+     * Enables caching of parsed OGNL expressions
+     * @since 2.6
+     */
+    public static final String STRUTS_OGNL_ENABLE_EXPRESSION_CACHE = 
"struts.ognl.enableExpressionCache";
+
+    /**
+     * Enables caching of parsed OGNL expressions
+     * @deprecated as of 2.6.  Use {@link 
#STRUTS_OGNL_ENABLE_EXPRESSION_CACHE} instead.
+     */
+    public static final String STRUTS_ENABLE_OGNL_EXPRESSION_CACHE = 
STRUTS_OGNL_ENABLE_EXPRESSION_CACHE;
+
+    /**
+     * Enables evaluation of OGNL expressions
+     * @since 2.6
+     */
+    public static final String STRUTS_OGNL_ENABLE_EVAL_EXPRESSION = 
"struts.ognl.enableEvalExpression";
 
-    /** Enables evaluation of OGNL expressions */
-    public static final String STRUTS_ENABLE_OGNL_EVAL_EXPRESSION = 
"struts.ognl.enableOGNLEvalExpression";
+    /**
+     * Enables evaluation of OGNL expressions
+     * @deprecated as of 2.6.  Use {@link #STRUTS_OGNL_ENABLE_EVAL_EXPRESSION} 
instead.
+     */
+    public static final String STRUTS_ENABLE_OGNL_EVAL_EXPRESSION = 
STRUTS_OGNL_ENABLE_EVAL_EXPRESSION;
 
     /** The maximum length of an expression (OGNL) */
     public static final String STRUTS_OGNL_EXPRESSION_MAX_LENGTH = 
"struts.ognl.expressionMaxLength";
diff --git 
a/core/src/main/java/org/apache/struts2/config/entities/ConstantConfig.java 
b/core/src/main/java/org/apache/struts2/config/entities/ConstantConfig.java
index df08ac7..0136082 100644
--- a/core/src/main/java/org/apache/struts2/config/entities/ConstantConfig.java
+++ b/core/src/main/java/org/apache/struts2/config/entities/ConstantConfig.java
@@ -101,7 +101,7 @@ public class ConstantConfig {
     private Boolean elThrowExceptionOnFailure;
     private Boolean ognlLogMissingProperties;
     private Boolean ognlEnableExpressionCache;
-    private Boolean ognlEnableOGNLEvalExpression;
+    private Boolean ognlEnableEvalExpression;
     private Boolean disableRequestAttributeValueStackLookup;
     private BeanConfig viewUrlHelper;
     private BeanConfig converterCollection;
@@ -230,8 +230,8 @@ public class ConstantConfig {
         map.put(StrutsConstants.STRUTS_UNKNOWN_HANDLER_MANAGER, 
beanConfToString(unknownHandlerManager));
         map.put(StrutsConstants.STRUTS_EL_THROW_EXCEPTION, 
Objects.toString(elThrowExceptionOnFailure, null));
         map.put(StrutsConstants.STRUTS_OGNL_LOG_MISSING_PROPERTIES, 
Objects.toString(ognlLogMissingProperties, null));
-        map.put(StrutsConstants.STRUTS_ENABLE_OGNL_EXPRESSION_CACHE, 
Objects.toString(ognlEnableExpressionCache, null));
-        map.put(StrutsConstants.STRUTS_ENABLE_OGNL_EVAL_EXPRESSION, 
Objects.toString(ognlEnableOGNLEvalExpression, null));
+        map.put(StrutsConstants.STRUTS_OGNL_ENABLE_EXPRESSION_CACHE, 
Objects.toString(ognlEnableExpressionCache, null));
+        map.put(StrutsConstants.STRUTS_OGNL_ENABLE_EVAL_EXPRESSION, 
Objects.toString(ognlEnableEvalExpression, null));
         
map.put(StrutsConstants.STRUTS_DISABLE_REQUEST_ATTRIBUTE_VALUE_STACK_LOOKUP, 
Objects.toString(disableRequestAttributeValueStackLookup, null));
         map.put(StrutsConstants.STRUTS_URL_HELPER, 
beanConfToString(viewUrlHelper));
         map.put(StrutsConstants.STRUTS_CONVERTER_COLLECTION, 
beanConfToString(converterCollection));
@@ -922,12 +922,12 @@ public class ConstantConfig {
         this.ognlEnableExpressionCache = ognlEnableExpressionCache;
     }
 
-    public Boolean getOgnlEnableOGNLEvalExpression() {
-        return ognlEnableOGNLEvalExpression;
+    public Boolean getOgnlEnableEvalExpression() {
+        return ognlEnableEvalExpression;
     }
 
-    public void setOgnlEnableOGNLEvalExpression(Boolean 
ognlEnableOGNLEvalExpression) {
-        this.ognlEnableOGNLEvalExpression = ognlEnableOGNLEvalExpression;
+    public void setOgnlEnableEvalExpression(Boolean ognlEnableEvalExpression) {
+        this.ognlEnableEvalExpression = ognlEnableEvalExpression;
     }
 
     public Boolean getDisableRequestAttributeValueStackLookup() {

Reply via email to