diff --git a/spring-web/src/main/java/org/springframework/web/server/session/InMemoryWebSessionStore.java b/spring-web/src/main/java/org/springframework/web/server/session/InMemoryWebSessionStore.java index d65cfaf202..e53f8defda 100644 --- a/spring-web/src/main/java/org/springframework/web/server/session/InMemoryWebSessionStore.java +++ b/spring-web/src/main/java/org/springframework/web/server/session/InMemoryWebSessionStore.java @@ -46,7 +46,6 @@ public class InMemoryWebSessionStore implements WebSessionStore { /** Minimum period between expiration checks */ private static final Duration EXPIRATION_CHECK_PERIOD = Duration.ofSeconds(60); - private static final IdGenerator idGenerator = new JdkIdGenerator(); @@ -210,11 +209,7 @@ public class InMemoryWebSessionStore implements WebSessionStore { @Override public Mono changeSessionId() { String currentId = this.id.get(); - if (InMemoryWebSessionStore.this.sessions.remove(currentId) == null) { - return Mono.error(new IllegalStateException( - "Failed to change session id: " + currentId + - " because the Session is no longer present in the store.")); - } + InMemoryWebSessionStore.this.sessions.remove(currentId); String newId = String.valueOf(idGenerator.generateId()); this.id.set(newId); InMemoryWebSessionStore.this.sessions.put(this.getId(), this);