From f425a993e7be82ffdbdda24370925a34c42925f2 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Mon, 27 Apr 2020 13:19:43 +0100 Subject: [PATCH] Ignore missing STOMP decoder if session closed Closes gh-24842 --- .../web/socket/messaging/StompSubProtocolHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java b/spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java index f483ca0c6e..b47ec0fca2 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -240,6 +240,10 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE BufferingStompDecoder decoder = this.decoders.get(session.getId()); if (decoder == null) { + if (!session.isOpen()) { + logger.trace("Dropped inbound WebSocket message due to closed session"); + return; + } throw new IllegalStateException("No decoder for session id '" + session.getId() + "'"); }