You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by jo...@apache.org on 2015/07/12 18:15:16 UTC

[2/3] struts git commit: using log with message parameters

using log with message parameters


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/3c9ff04b
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/3c9ff04b
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/3c9ff04b

Branch: refs/heads/master
Commit: 3c9ff04bdbe376587fd493fd6f48df6eaa49e863
Parents: 72e8b10
Author: Aleksandr Mashchenko <al...@gmail.com>
Authored: Sat Jul 11 14:59:57 2015 +0300
Committer: Aleksandr Mashchenko <al...@gmail.com>
Committed: Sat Jul 11 14:59:57 2015 +0300

----------------------------------------------------------------------
 .../struts2/interceptor/RolesInterceptor.java   | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/3c9ff04b/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java
index 5b95fef..a8fce67 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java
@@ -120,14 +120,10 @@ public class RolesInterceptor extends AbstractInterceptor {
           throw new IllegalArgumentException("RolesInterceptor is misconfigured, check logs for erroneous configuration!");
         }
         if (!isAllowed(request, invocation.getAction())) {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Request is NOT allowed. Rejecting.");
-            }
+            LOG.debug("Request is NOT allowed. Rejecting.");
             return handleRejection(invocation, response);
         } else {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Request is allowed. Invoking.");
-            }
+            LOG.debug("Request is allowed. Invoking.");
             return invocation.invoke();
         }
     }
@@ -154,25 +150,19 @@ public class RolesInterceptor extends AbstractInterceptor {
     protected boolean isAllowed(HttpServletRequest request, Object action) {
         for (String role : disallowedRoles) {
             if (request.isUserInRole(role)) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("User role '" + role + "' is in the disallowedRoles list.");
-                }
+                LOG.debug("User role '{}' is in the disallowedRoles list.", role);
                 return false;
             }
         }
   
         if (allowedRoles.isEmpty()){
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("The allowedRoles list is empty.");
-            }
+            LOG.debug("The allowedRoles list is empty.");
             return true;
         }
         
         for (String role : allowedRoles) {
             if (request.isUserInRole(role)) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("User role '" + role + "' is in the allowedRoles list.");
-                }
+                LOG.debug("User role '{}' is in the allowedRoles list.", role);
                 return true;
             }
         }