You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by ku...@apache.org on 2023/08/30 02:49:23 UTC

[struts] branch WW-5342-default-package created (now 4a5edf640)

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

kusal pushed a change to branch WW-5342-default-package
in repository https://gitbox.apache.org/repos/asf/struts.git


      at 4a5edf640 WW-5342 Ban use of default package

This branch includes the following new commits:

     new 4a5edf640 WW-5342 Ban use of default package

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[struts] 01/01: WW-5342 Ban use of default package

Posted by ku...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kusal pushed a commit to branch WW-5342-default-package
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 4a5edf640fb9e54eb22ee5421ba49cab9583a598
Author: Kusal Kithul-Godage <gi...@kusal.io>
AuthorDate: Wed Aug 30 12:49:14 2023 +1000

    WW-5342 Ban use of default package
---
 .../main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java b/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java
index 3e1c69d5d..2ce702008 100644
--- a/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java
+++ b/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java
@@ -149,7 +149,8 @@ public class SecurityMemberAccess implements MemberAccess {
         }
 
         if (targetClass.getPackage() == null || memberClass.getPackage() == null) {
-            LOG.warn("The use of the default (unnamed) package is discouraged!");
+            LOG.warn("The use of the default package is blocked!");
+            return false;
         }
 
         if (isPackageExcluded(targetClass)) {
@@ -225,7 +226,7 @@ public class SecurityMemberAccess implements MemberAccess {
 
     public static String toPackageName(Class<?> clazz) {
         if (clazz.getPackage() == null) {
-            return "";
+            throw new IllegalArgumentException("The use of the default package is blocked!");
         }
         return clazz.getPackage().getName();
     }