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

kusal pushed a commit to branch WW-5340-ognl-guard
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 4c4ec52b39e2bd206e61a894116e4a456e6837bb
Author: Kusal Kithul-Godage <g...@kusal.io>
AuthorDate: Wed Sep 27 22:01:54 2023 +1000

    WW-5340 Rename blocked by OgnlGuard string
---
 core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java |  4 ++--
 core/src/main/java/org/apache/struts2/ognl/OgnlGuard.java     | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

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 dfbc1c498..4bddad63a 100644
--- a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
+++ b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
@@ -59,7 +59,7 @@ import static java.util.Collections.unmodifiableSet;
 import static java.util.Objects.requireNonNull;
 import static java.util.stream.Collectors.toSet;
 import static org.apache.commons.lang3.StringUtils.strip;
-import static org.apache.struts2.ognl.OgnlGuard.GUARD_BLOCKED;
+import static org.apache.struts2.ognl.OgnlGuard.EXPR_BLOCKED;
 
 
 /**
@@ -607,7 +607,7 @@ public class OgnlUtil {
                 expressionCache.put(expr, tree);
             }
         }
-        if (GUARD_BLOCKED.equals(tree)) {
+        if (EXPR_BLOCKED.equals(tree)) {
             throw new OgnlException("Expression blocked by OgnlGuard: " + 
expr);
         }
         return tree;
diff --git a/core/src/main/java/org/apache/struts2/ognl/OgnlGuard.java 
b/core/src/main/java/org/apache/struts2/ognl/OgnlGuard.java
index 5a0e35989..8924c4684 100644
--- a/core/src/main/java/org/apache/struts2/ognl/OgnlGuard.java
+++ b/core/src/main/java/org/apache/struts2/ognl/OgnlGuard.java
@@ -30,7 +30,7 @@ import ognl.OgnlException;
  */
 public interface OgnlGuard {
 
-    String GUARD_BLOCKED = "_ognl_guard_blocked";
+    String EXPR_BLOCKED = "_ognl_guard_blocked";
 
     /**
      * Determines whether an OGNL expression should be blocked based on 
validation done on both the raw expression and
@@ -40,7 +40,7 @@ public interface OgnlGuard {
      * @return whether the expression should be blocked
      */
     default boolean isBlocked(String expr) throws OgnlException {
-        return GUARD_BLOCKED.equals(parseExpression(expr));
+        return EXPR_BLOCKED.equals(parseExpression(expr));
     }
 
     /**
@@ -48,15 +48,15 @@ public interface OgnlGuard {
      * validation rules in {@link #isRawExpressionBlocked} and {@link 
#isParsedTreeBlocked}.
      *
      * @param expr OGNL expression
-     * @return parsed expression or {@link #GUARD_BLOCKED} if the expression 
should be blocked
+     * @return parsed expression or {@link #EXPR_BLOCKED} if the expression 
should be blocked
      */
     default Object parseExpression(String expr) throws OgnlException {
         if (isRawExpressionBlocked(expr)) {
-            return GUARD_BLOCKED;
+            return EXPR_BLOCKED;
         }
         Object tree = Ognl.parseExpression(expr);
         if (isParsedTreeBlocked(tree)) {
-            return GUARD_BLOCKED;
+            return EXPR_BLOCKED;
         }
         return tree;
     }

Reply via email to