From 3c9ff04bdbe376587fd493fd6f48df6eaa49e863 Mon Sep 17 00:00:00 2001 From: Aleksandr Mashchenko Date: Sat, 11 Jul 2015 14:59:57 +0300 Subject: [PATCH] using log with message parameters --- .../struts2/interceptor/RolesInterceptor.java | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) 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 5b95fefb0..a8fce6746 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; } }