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

lukaszlenart pushed a commit to branch fix/excluded-packages
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 04d9ec389d34e02ba148b6cbfdc47843a4e13add
Author: Lukasz Lenart <lukaszlen...@apache.org>
AuthorDate: Fri Jan 3 16:54:25 2025 +0100

    Excludes new & old packages
---
 .../src/main/resources/struts-excluded-classes.xml | 10 ++++
 .../opensymphony/xwork2/test/StrutsUtilBean.java   | 43 ++++++++++++++++++
 .../org/apache/struts2/util/StrutsUtilTest.java    | 53 ++++------------------
 3 files changed, 63 insertions(+), 43 deletions(-)

diff --git a/core/src/main/resources/struts-excluded-classes.xml 
b/core/src/main/resources/struts-excluded-classes.xml
index 58b89aae4..bd83978cd 100644
--- a/core/src/main/resources/struts-excluded-classes.xml
+++ b/core/src/main/resources/struts-excluded-classes.xml
@@ -29,6 +29,7 @@
     <constant name="struts.excludedClasses"
               value="
                 com.opensymphony.xwork2.ActionContext,
+                org.apache.struts2.ActionContext,
                 java.lang.Class,
                 java.lang.ClassLoader,
                 java.lang.InheritableThreadLocal,
@@ -75,10 +76,15 @@
               value="
                 antlr.build,
                 com.opensymphony.xwork2.config,
+                org.apache.struts2.config,
                 com.opensymphony.xwork2.inject,
+                org.apache.struts2.inject,
                 com.opensymphony.xwork2.ognl,
+                org.apache.struts2.ognl,
                 com.opensymphony.xwork2.security,
+                org.apache.struts2.security,
                 com.opensymphony.xwork2.util,
+                org.apache.struts2.util,
                 freemarker.core,
                 freemarker.ext.jsp,
                 freemarker.ext.rhino,
@@ -108,9 +114,13 @@
               value="
                 antlr.build,
                 com.opensymphony.xwork2.config,
+                org.apache.struts2.config,
                 com.opensymphony.xwork2.inject,
+                org.apache.struts2.inject,
                 com.opensymphony.xwork2.ognl,
+                org.apache.struts2.ognl,
                 com.opensymphony.xwork2.security,
+                org.apache.struts2.security,
                 com.opensymphony.xwork2.util,
                 freemarker.core,
                 freemarker.ext.jsp,
diff --git 
a/core/src/test/java/com/opensymphony/xwork2/test/StrutsUtilBean.java 
b/core/src/test/java/com/opensymphony/xwork2/test/StrutsUtilBean.java
new file mode 100644
index 000000000..25eceb98b
--- /dev/null
+++ b/core/src/test/java/com/opensymphony/xwork2/test/StrutsUtilBean.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.opensymphony.xwork2.test;
+
+public class StrutsUtilBean {
+
+    public String getMyString() {
+        return "myString";
+    }
+
+    public boolean getMyBoolean(boolean bool) {
+        return bool;
+    }
+
+    public String getFoo() {
+        return "bar";
+    }
+
+    public String getBarExpression() {
+        return "%{bar}";
+    }
+
+    public String getBar() {
+        return "bar";
+    }
+
+}
diff --git a/core/src/test/java/org/apache/struts2/util/StrutsUtilTest.java 
b/core/src/test/java/org/apache/struts2/util/StrutsUtilTest.java
index bd1de3313..0ca118c53 100644
--- a/core/src/test/java/org/apache/struts2/util/StrutsUtilTest.java
+++ b/core/src/test/java/org/apache/struts2/util/StrutsUtilTest.java
@@ -19,6 +19,7 @@
 package org.apache.struts2.util;
 
 import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.test.StrutsUtilBean;
 import com.opensymphony.xwork2.util.ValueStack;
 import org.apache.struts2.StrutsInternalTestCase;
 import org.apache.struts2.TestAction;
@@ -37,7 +38,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * Test case for StrutsUtil.
- *
  */
 public class StrutsUtilTest extends StrutsInternalTestCase {
 
@@ -53,14 +53,7 @@ public class StrutsUtilTest extends StrutsInternalTestCase {
     }
 
     public void testIsTrueMethod() {
-        stack.push(new Object() {
-            public String getMyString() {
-                return "myString";
-            }
-            public boolean getMyBoolean(boolean bool) {
-                return bool;
-            }
-        });
+        stack.push(new StrutsUtilBean());
         assertTrue(strutsUtil.isTrue("myString == 'myString'"));
         assertFalse(strutsUtil.isTrue("myString == 'myOtherString'"));
         assertTrue(strutsUtil.isTrue("getMyBoolean(true)"));
@@ -68,14 +61,7 @@ public class StrutsUtilTest extends StrutsInternalTestCase {
     }
 
     public void testFindStringMethod() {
-        stack.push(new Object() {
-            public String getMyString() {
-                return "myString";
-            }
-            public boolean getMyBoolean(boolean bool) {
-                return bool;
-            }
-        });
+        stack.push(new StrutsUtilBean());
 
         assertEquals(strutsUtil.findString("myString"), "myString");
         assertNull(strutsUtil.findString("myOtherString"));
@@ -105,14 +91,7 @@ public class StrutsUtilTest extends StrutsInternalTestCase {
 
 
     public void testFindValueMethod() throws Exception {
-        stack.push(new Object() {
-            public String getMyString() {
-                return "myString";
-            }
-            public boolean getMyBoolean(boolean bool) {
-                return bool;
-            }
-        });
+        stack.push(new StrutsUtilBean());
         Object obj1 = strutsUtil.findValue("myString", "java.lang.String");
         Object obj2 = strutsUtil.findValue("getMyBoolean(true)", 
"java.lang.Boolean");
 
@@ -125,7 +104,6 @@ public class StrutsUtilTest extends StrutsInternalTestCase {
     }
 
 
-
     public void testGetTextMethod() {
         // this should be in xwork-messages.properties (included by default
         // by LocalizedTextUtil
@@ -233,11 +211,7 @@ public class StrutsUtilTest extends StrutsInternalTestCase 
{
     }
 
     public void testTranslateVariables() {
-        stack.push(new Object() {
-            public String getFoo() {
-                return "bar";
-            }
-        });
+        stack.push(new StrutsUtilBean());
         String obj1 = strutsUtil.translateVariables("try: %{foo}");
 
         assertNotNull(obj1);
@@ -245,15 +219,8 @@ public class StrutsUtilTest extends StrutsInternalTestCase 
{
     }
 
     public void testTranslateVariablesRecursion() {
-        stack.push(new Object() {
-            public String getFoo() {
-                return "%{bar}";
-            }
-            public String getBar() {
-                return "bar";
-            }
-        });
-        String obj1 = strutsUtil.translateVariables("try: %{foo}");
+        stack.push(new StrutsUtilBean());
+        String obj1 = strutsUtil.translateVariables("try: %{barExpression}");
 
         assertNotNull(obj1);
         assertEquals("try: %{bar}", obj1);
@@ -277,12 +244,10 @@ public class StrutsUtilTest extends 
StrutsInternalTestCase {
         super.tearDown();
     }
 
-
-
     // === internal class to assist in testing
-
     protected static class InternalMockHttpServletRequest extends 
MockHttpServletRequest {
         InternalMockRequestDispatcher dispatcher = null;
+
         public RequestDispatcher getRequestDispatcher(String path) {
             dispatcher = new InternalMockRequestDispatcher(path);
             return dispatcher;
@@ -296,10 +261,12 @@ public class StrutsUtilTest extends 
StrutsInternalTestCase {
     protected static class InternalMockRequestDispatcher extends 
MockRequestDispatcher {
         private final String url;
         boolean included = false;
+
         public InternalMockRequestDispatcher(String url) {
             super(url);
             this.url = url;
         }
+
         public void include(ServletRequest servletRequest, ServletResponse 
servletResponse) {
             if (servletResponse instanceof MockHttpServletResponse) {
                 ((MockHttpServletResponse) 
servletResponse).setIncludedUrl(this.url);

Reply via email to