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/08/17 08:47:36 UTC

[struts] 01/01: WW-5327 Removes duplicated exclusion Refs #715

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

lukaszlenart pushed a commit to branch fix/WW-5327-removes-duplicate
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 956a956efb996e38b75f2b2c7f63c1c172ddfb9c
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Thu Aug 17 10:47:29 2023 +0200

    WW-5327 Removes duplicated exclusion
    Refs #715
---
 core/src/main/resources/struts-excluded-classes.xml               | 3 +--
 core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java | 8 ++++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/core/src/main/resources/struts-excluded-classes.xml b/core/src/main/resources/struts-excluded-classes.xml
index 294e2399b..a7ee4f421 100644
--- a/core/src/main/resources/struts-excluded-classes.xml
+++ b/core/src/main/resources/struts-excluded-classes.xml
@@ -38,8 +38,7 @@
                 java.lang.Thread,
                 sun.misc.Unsafe,
                 com.opensymphony.xwork2.ActionContext,
-                com.opensymphony.xwork2.ognl.SecurityMemberAccess,
-                com.opensymphony.xwork2.ognl.OgnlValueStack"/>
+                com.opensymphony.xwork2.ognl.SecurityMemberAccess"/>
 
     <constant name="struts.devMode.excludedClasses"
               value="
diff --git a/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java b/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java
index 301704316..3a46fdb62 100644
--- a/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java
@@ -877,10 +877,10 @@ public class OgnlUtilTest extends XWorkTestCase {
         assertEquals(123, foo.getALong());
     }
 
-    public void testBeanMapExpressions() throws OgnlException {
+    public void testBeanMapExpressions() throws OgnlException, NoSuchMethodException {
         Foo foo = new Foo();
-        ognlUtil.setExcludedClasses(
-                "com.opensymphony.xwork2.ognl.SecurityMemberAccess"
+        ognlUtil.setExcludedPackageNames(
+                "com.opensymphony.xwork2.ognl."
         );
 
         Map<String, Object> context = ognlUtil.createDefaultContext(foo);
@@ -901,7 +901,7 @@ public class OgnlUtilTest extends XWorkTestCase {
         assertEquals(foo.getTitle(), expression);
 
         SecurityMemberAccess sma = (SecurityMemberAccess) ((OgnlContext) context).getMemberAccess();
-        assertTrue(sma.isClassExcluded(SecurityMemberAccess.class));
+        assertFalse(sma.isAccessible(context, sma, sma.getClass().getDeclaredMethod("setExcludedClasses", Set.class), "excludedClasses"));
     }
 
     public void testNullProperties() {