Skip to content

Commit cc76a04

Browse files
authored
Merge pull request #1520 from ropalka/UNDERTOW-2316
[UNDERTOW-2316] Unify InMemorySessionManager with DistributableSessionManager - allow null exchanges
2 parents d8b9bea + 15b4159 commit cc76a04

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

core/src/main/java/io/undertow/server/session/InMemorySessionManager.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,18 @@ private String createAndSaveNewID(SessionImpl session) {
228228
public Session getSession(final HttpServerExchange serverExchange, final SessionConfig config) {
229229
if (serverExchange != null) {
230230
SessionImpl newSession = serverExchange.getAttachment(NEW_SESSION);
231-
if(newSession != null) {
231+
if (newSession != null) {
232232
return newSession;
233233
}
234-
} else {
235-
return null;
236234
}
235+
236+
if (config == null) {
237+
throw UndertowMessages.MESSAGES.couldNotFindSessionCookieConfig();
238+
}
239+
237240
String sessionId = config.findSessionId(serverExchange);
238241
InMemorySessionManager.SessionImpl session = (SessionImpl) getSession(sessionId);
239-
if(session != null && serverExchange != null) {
242+
if (session != null && serverExchange != null) {
240243
session.requestStarted(serverExchange);
241244
}
242245
return session;

0 commit comments

Comments
 (0)