Polishing contribution

Closes gh-28836
This commit is contained in:
Rossen Stoyanchev 2022-07-27 15:23:40 +03:00
parent b6144e5682
commit 2172b99fee
1 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 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.
@ -33,7 +33,6 @@ import org.springframework.http.server.reactive.AbstractListenerReadPublisher;
import org.springframework.http.server.reactive.AbstractListenerWriteProcessor;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.reactive.socket.CloseStatus;
import org.springframework.web.reactive.socket.HandshakeInfo;
import org.springframework.web.reactive.socket.WebSocketHandler;
@ -248,12 +247,13 @@ public abstract class AbstractListenerWebSocketSession<T> extends AbstractWebSoc
if (this.handlerCompletionMono != null) {
this.handlerCompletionMono.onError(ex);
}
if(!StringUtils.hasText(ex.getMessage())) {
close(CloseStatus.SERVER_ERROR);
if (logger.isDebugEnabled()) {
logger.debug("WebSocket session completed with error", ex);
}
else {
close(CloseStatus.SERVER_ERROR.withReason(ex.getMessage()));
else if (logger.isInfoEnabled()) {
logger.info("WebSocket session completed with error: " + ex.getMessage());
}
close(CloseStatus.SERVER_ERROR);
}
@Override