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

kusal pushed a commit to branch WW-5343-sec-extend
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 8bf47b3679d6b66984a237eb435feaaab8d0b042
Author: Kusal Kithul-Godage <g...@kusal.io>
AuthorDate: Wed Nov 15 00:28:46 2023 +1100

    WW-5343 Fix OgnlUtilTest#testBeanMapExpressions
---
 .../src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

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 8db142ba6..b1ed266a0 100644
--- a/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java
@@ -889,11 +889,11 @@ public class OgnlUtilTest extends XWorkTestCase {
 
     public void testBeanMapExpressions() throws OgnlException, 
NoSuchMethodException {
         Foo foo = new Foo();
-        ognlUtil.setExcludedPackageNames(
-                "com.opensymphony.xwork2.ognl."
-        );
 
         Map<String, Object> context = ognlUtil.createDefaultContext(foo);
+        SecurityMemberAccess sma = (SecurityMemberAccess) ((OgnlContext) 
context).getMemberAccess();
+
+        sma.useExcludedPackageNames("com.opensymphony.xwork2.ognl");
 
         String expression = "%{\n" +
             "(#request.a=#@org.apache.commons.collections.BeanMap@{}) +\n" +
@@ -910,8 +910,7 @@ public class OgnlUtilTest extends XWorkTestCase {
 
         assertEquals(foo.getTitle(), expression);
 
-        SecurityMemberAccess sma = (SecurityMemberAccess) ((OgnlContext) 
context).getMemberAccess();
-        assertFalse(sma.isAccessible(context, sma, 
sma.getClass().getDeclaredMethod("useExcludedClasses", Set.class), 
"excludedClasses"));
+        assertFalse(sma.isAccessible(context, sma, 
sma.getClass().getDeclaredMethod("useExcludedClasses", String.class), 
"excludedClasses"));
     }
 
     public void testNullProperties() {

Reply via email to