From 8cb1d7fffa8a57a3b0b4abd73e2df5c929595aaa Mon Sep 17 00:00:00 2001 From: joos-edia Date: Wed, 12 Jun 2019 22:34:32 +0200 Subject: [PATCH] Move log statement Moved after removeSessionInformation() is called for comprehensible output to log file. The log statements are now written in correct order. Before the change, this could be confusing when debugging an application, since it seemed that the registered session was immediately removed when only looking at the logs. --- .../security/core/session/SessionRegistryImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/springframework/security/core/session/SessionRegistryImpl.java b/core/src/main/java/org/springframework/security/core/session/SessionRegistryImpl.java index b476ece2c86..b988a2fa46b 100644 --- a/core/src/main/java/org/springframework/security/core/session/SessionRegistryImpl.java +++ b/core/src/main/java/org/springframework/security/core/session/SessionRegistryImpl.java @@ -120,15 +120,15 @@ public void registerNewSession(String sessionId, Object principal) { Assert.hasText(sessionId, "SessionId required as per interface contract"); Assert.notNull(principal, "Principal required as per interface contract"); + if (getSessionInformation(sessionId) != null) { + removeSessionInformation(sessionId); + } + if (logger.isDebugEnabled()) { logger.debug("Registering session " + sessionId + ", for principal " + principal); } - if (getSessionInformation(sessionId) != null) { - removeSessionInformation(sessionId); - } - sessionIds.put(sessionId, new SessionInformation(principal, sessionId, new Date()));