From 1d837a835c04078ec66325e9fb9de21ac401874e Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Wed, 30 Nov 2016 15:10:15 +0700 Subject: prevent string concatenation for disabled loggers --- .../java/com/juick/service/security/SimpleRememberMeServices.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'juick-server/src/main/java/com/juick') diff --git a/juick-server/src/main/java/com/juick/service/security/SimpleRememberMeServices.java b/juick-server/src/main/java/com/juick/service/security/SimpleRememberMeServices.java index 2a28866c..aef133d3 100644 --- a/juick-server/src/main/java/com/juick/service/security/SimpleRememberMeServices.java +++ b/juick-server/src/main/java/com/juick/service/security/SimpleRememberMeServices.java @@ -5,6 +5,8 @@ import com.juick.server.security.entities.JuickUser; import com.juick.service.UserService; import com.juick.util.UserUtils; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.core.env.Environment; import org.springframework.security.core.Authentication; import org.springframework.security.core.userdetails.UserDetails; @@ -23,6 +25,8 @@ import java.util.Optional; * Created by aalexeev on 11/28/16. */ public class SimpleRememberMeServices extends AbstractRememberMeServices implements RememberMeServices { + private static final Logger logger = LoggerFactory.getLogger(SimpleRememberMeServices.class); + private final UserService userService; public SimpleRememberMeServices( @@ -49,7 +53,7 @@ public class SimpleRememberMeServices extends AbstractRememberMeServices impleme HttpServletRequest request, HttpServletResponse response, Authentication successfulAuthentication) { String username = successfulAuthentication.getName(); - logger.debug("Creating new persistent login for user " + username); + logger.debug("Creating new persistent login for user {}", username); try { int uid = userService.getUIDbyName(username); @@ -62,7 +66,7 @@ public class SimpleRememberMeServices extends AbstractRememberMeServices impleme setCookie(new String[]{hash}, getTokenValiditySeconds(), request, response); } catch (Exception e) { - logger.error("Failed to save cookies ", e); + logger.error("Failed to save cookies", e); } } -- cgit v1.2.3