struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4769) Make SecurityMethodAccess excluded classes & packages definitions immutable
Date Mon, 18 Jun 2018 08:45:00 GMT

    [ https://issues.apache.org/jira/browse/WW-4769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16515495#comment-16515495
] 

ASF GitHub Bot commented on WW-4769:
------------------------------------

lukaszlenart closed pull request #232: WW-4769 add unit tests to verify immutable collections
URL: https://github.com/apache/struts/pull/232
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 87578a7a3..3b3c8ae01 100644
--- a/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java
@@ -821,6 +821,51 @@ public void testAccessContext() throws Exception {
         assertSame(that, root);
     }
 
+    public void testGetExcludedPackageNames() {
+      // Getter should return an immutable collection
+      OgnlUtil util = new OgnlUtil();
+      util.setExcludedPackageNames("java.lang,java.awt");
+      assertEquals(util.getExcludedPackageNames().size(), 2);
+      try {
+          util.getExcludedPackageNames().clear();
+      }
+      catch (Exception ex) {
+          assertTrue(ex instanceof UnsupportedOperationException);
+      } finally {
+          assertEquals(util.getExcludedPackageNames().size(), 2);
+      }
+    }
+
+    public void testGetExcludedClasses() {
+        // Getter should return an immutable collection
+        OgnlUtil util = new OgnlUtil();
+        util.setExcludedClasses("java.lang.Runtime,java.lang.ProcessBuilder,java.net.URL");
+        assertEquals(util.getExcludedClasses().size(), 3);
+        try {
+            util.getExcludedClasses().clear();
+        }
+        catch (Exception ex) {
+            assertTrue(ex instanceof UnsupportedOperationException);
+        } finally {
+            assertEquals(util.getExcludedClasses().size(), 3);
+        }
+    }
+
+    public void testGetExcludedPackageNamePatterns() {
+        // Getter should return an immutable collection
+        OgnlUtil util = new OgnlUtil();
+        util.setExcludedPackageNamePatterns("java.lang.");
+        assertEquals(util.getExcludedPackageNamePatterns().size(), 1);
+        try {
+            util.getExcludedPackageNamePatterns().clear();
+        }
+        catch (Exception ex) {
+            assertTrue(ex instanceof UnsupportedOperationException);
+        } finally {
+            assertEquals(util.getExcludedPackageNamePatterns().size(), 1);
+        }
+    }
+
     public static class Email {
         String address;
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Make SecurityMethodAccess excluded classes & packages definitions immutable
> ---------------------------------------------------------------------------
>
>                 Key: WW-4769
>                 URL: https://issues.apache.org/jira/browse/WW-4769
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 2.5.10
>            Reporter: Lukasz Lenart
>            Assignee: Lukasz Lenart
>            Priority: Major
>             Fix For: 2.5.12
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message