You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2023/10/04 11:45:34 UTC

[struts] 01/01: WW-5338 Removes also deprecated constant in ContextUtil

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

lukaszlenart pushed a commit to branch feature/WW-5338-remove-ognltool
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 2d7bff3ca87fbaa342b818c608e0d236b8926980
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Wed Oct 4 13:22:56 2023 +0200

    WW-5338 Removes also deprecated constant in ContextUtil
---
 core/src/main/java/org/apache/struts2/util/StrutsUtil.java            | 2 +-
 core/src/main/java/org/apache/struts2/views/util/ContextUtil.java     | 2 --
 .../main/java/org/apache/struts2/views/velocity/VelocityManager.java  | 4 +---
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java
index 13c574fbd..c693599e7 100644
--- a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java
+++ b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java
@@ -119,8 +119,8 @@ public class StrutsUtil {
     }
 
     public Object findValue(String expr, Object context) {
+        stack.push(context);
         try {
-            stack.push(context);
             return stack.findValue(expr, true);
         } finally {
             stack.pop();
diff --git a/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java b/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java
index 97c148f37..4ab3c2786 100644
--- a/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java
+++ b/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java
@@ -36,7 +36,6 @@ public class ContextUtil {
     public static final String SESSION = "session";
     public static final String BASE = "base";
     public static final String STACK = "stack";
-    public static final String OGNL = "ognl";
     public static final String STRUTS = "struts";
     public static final String ACTION = "action";
 
@@ -49,7 +48,6 @@ public class ContextUtil {
         map.put(STACK, stack);
         StrutsUtil util = new StrutsUtil(stack, req, res);
         map.put(STRUTS, util);
-        map.put(OGNL, util); // Deprecated since 6.3.0
 
         ActionInvocation invocation = stack.getActionContext().getActionInvocation();
         if (invocation != null) {
diff --git a/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java b/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java
index 7acb9bdc1..5cff252e3 100644
--- a/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java
+++ b/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java
@@ -56,8 +56,7 @@ import java.util.Properties;
 import static java.lang.String.format;
 import static java.util.Collections.emptyList;
 import static java.util.stream.Collectors.joining;
-import static java.util.stream.Collectors.toList;
-import static org.apache.struts2.views.util.ContextUtil.OGNL;
+import static java.util.stream.Collectors.toList;;
 import static org.apache.struts2.views.util.ContextUtil.STRUTS;
 
 /**
@@ -133,7 +132,6 @@ public class VelocityManager {
         ContextUtil.getStandardContext(stack, req, res).forEach(context::put);
         VelocityStrutsUtil util = new VelocityStrutsUtil(velocityEngine, context, stack, req, res);
         context.put(STRUTS, util);
-        context.put(OGNL, util); // Deprecated since 6.3.0
         return context;
     }