Refine Throwable handling in spring-websocket
This commit lowers the level of Throwable handling in parts of spring-websocket which now handle Exception instead and allow any Error to propagate. Closes gh-24075
This commit is contained in:
parent
70a3dbff24
commit
526d89e1e6
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -71,7 +71,7 @@ public class JettyWebSocketHandlerAdapter {
|
||||||
this.wsSession.initializeNativeSession(session);
|
this.wsSession.initializeNativeSession(session);
|
||||||
this.webSocketHandler.afterConnectionEstablished(this.wsSession);
|
this.webSocketHandler.afterConnectionEstablished(this.wsSession);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +82,7 @@ public class JettyWebSocketHandlerAdapter {
|
||||||
try {
|
try {
|
||||||
this.webSocketHandler.handleMessage(this.wsSession, message);
|
this.webSocketHandler.handleMessage(this.wsSession, message);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -93,7 +93,7 @@ public class JettyWebSocketHandlerAdapter {
|
||||||
try {
|
try {
|
||||||
this.webSocketHandler.handleMessage(this.wsSession, message);
|
this.webSocketHandler.handleMessage(this.wsSession, message);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -106,7 +106,7 @@ public class JettyWebSocketHandlerAdapter {
|
||||||
try {
|
try {
|
||||||
this.webSocketHandler.handleMessage(this.wsSession, message);
|
this.webSocketHandler.handleMessage(this.wsSession, message);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -118,7 +118,7 @@ public class JettyWebSocketHandlerAdapter {
|
||||||
try {
|
try {
|
||||||
this.webSocketHandler.afterConnectionClosed(this.wsSession, closeStatus);
|
this.webSocketHandler.afterConnectionClosed(this.wsSession, closeStatus);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
if (logger.isWarnEnabled()) {
|
if (logger.isWarnEnabled()) {
|
||||||
logger.warn("Unhandled exception after connection closed for " + this, ex);
|
logger.warn("Unhandled exception after connection closed for " + this, ex);
|
||||||
}
|
}
|
||||||
|
|
@ -130,7 +130,7 @@ public class JettyWebSocketHandlerAdapter {
|
||||||
try {
|
try {
|
||||||
this.webSocketHandler.handleTransportError(this.wsSession, cause);
|
this.webSocketHandler.handleTransportError(this.wsSession, cause);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -103,7 +103,7 @@ public class StandardWebSocketHandlerAdapter extends Endpoint {
|
||||||
try {
|
try {
|
||||||
this.handler.afterConnectionEstablished(this.wsSession);
|
this.handler.afterConnectionEstablished(this.wsSession);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -113,7 +113,7 @@ public class StandardWebSocketHandlerAdapter extends Endpoint {
|
||||||
try {
|
try {
|
||||||
this.handler.handleMessage(this.wsSession, textMessage);
|
this.handler.handleMessage(this.wsSession, textMessage);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -123,7 +123,7 @@ public class StandardWebSocketHandlerAdapter extends Endpoint {
|
||||||
try {
|
try {
|
||||||
this.handler.handleMessage(this.wsSession, binaryMessage);
|
this.handler.handleMessage(this.wsSession, binaryMessage);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -133,7 +133,7 @@ public class StandardWebSocketHandlerAdapter extends Endpoint {
|
||||||
try {
|
try {
|
||||||
this.handler.handleMessage(this.wsSession, pongMessage);
|
this.handler.handleMessage(this.wsSession, pongMessage);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -144,7 +144,7 @@ public class StandardWebSocketHandlerAdapter extends Endpoint {
|
||||||
try {
|
try {
|
||||||
this.handler.afterConnectionClosed(this.wsSession, closeStatus);
|
this.handler.afterConnectionClosed(this.wsSession, closeStatus);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
if (logger.isWarnEnabled()) {
|
if (logger.isWarnEnabled()) {
|
||||||
logger.warn("Unhandled on-close exception for " + this.wsSession, ex);
|
logger.warn("Unhandled on-close exception for " + this.wsSession, ex);
|
||||||
}
|
}
|
||||||
|
|
@ -156,7 +156,7 @@ public class StandardWebSocketHandlerAdapter extends Endpoint {
|
||||||
try {
|
try {
|
||||||
this.handler.handleTransportError(this.wsSession, exception);
|
this.handler.handleTransportError(this.wsSession, exception);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, ex, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -47,7 +47,7 @@ public class ExceptionWebSocketHandlerDecorator extends WebSocketHandlerDecorato
|
||||||
try {
|
try {
|
||||||
getDelegate().afterConnectionEstablished(session);
|
getDelegate().afterConnectionEstablished(session);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
tryCloseWithError(session, ex, logger);
|
tryCloseWithError(session, ex, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -57,7 +57,7 @@ public class ExceptionWebSocketHandlerDecorator extends WebSocketHandlerDecorato
|
||||||
try {
|
try {
|
||||||
getDelegate().handleMessage(session, message);
|
getDelegate().handleMessage(session, message);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
tryCloseWithError(session, ex, logger);
|
tryCloseWithError(session, ex, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -67,7 +67,7 @@ public class ExceptionWebSocketHandlerDecorator extends WebSocketHandlerDecorato
|
||||||
try {
|
try {
|
||||||
getDelegate().handleTransportError(session, exception);
|
getDelegate().handleTransportError(session, exception);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
tryCloseWithError(session, ex, logger);
|
tryCloseWithError(session, ex, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -77,7 +77,7 @@ public class ExceptionWebSocketHandlerDecorator extends WebSocketHandlerDecorato
|
||||||
try {
|
try {
|
||||||
getDelegate().afterConnectionClosed(session, closeStatus);
|
getDelegate().afterConnectionClosed(session, closeStatus);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
if (logger.isWarnEnabled()) {
|
if (logger.isWarnEnabled()) {
|
||||||
logger.warn("Unhandled exception after connection closed for " + this, ex);
|
logger.warn("Unhandled exception after connection closed for " + this, ex);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -157,7 +157,7 @@ public abstract class AbstractHandshakeHandler implements HandshakeHandler, Life
|
||||||
Class<?> clazz = ClassUtils.forName(className, AbstractHandshakeHandler.class.getClassLoader());
|
Class<?> clazz = ClassUtils.forName(className, AbstractHandshakeHandler.class.getClassLoader());
|
||||||
return (RequestUpgradeStrategy) ReflectionUtils.accessibleConstructor(clazz).newInstance();
|
return (RequestUpgradeStrategy) ReflectionUtils.accessibleConstructor(clazz).newInstance();
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Failed to instantiate RequestUpgradeStrategy: " + className, ex);
|
"Failed to instantiate RequestUpgradeStrategy: " + className, ex);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ public class HandshakeInterceptorChain {
|
||||||
try {
|
try {
|
||||||
interceptor.afterHandshake(request, response, this.wsHandler, failure);
|
interceptor.afterHandshake(request, response, this.wsHandler, failure);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
if (logger.isWarnEnabled()) {
|
if (logger.isWarnEnabled()) {
|
||||||
logger.warn(interceptor + " threw exception in afterHandshake: " + ex);
|
logger.warn(interceptor + " threw exception in afterHandshake: " + ex);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ public class WebSocketHttpRequestHandler implements HttpRequestHandler, Lifecycl
|
||||||
catch (HandshakeFailureException ex) {
|
catch (HandshakeFailureException ex) {
|
||||||
failure = ex;
|
failure = ex;
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
failure = new HandshakeFailureException("Uncaught failure for request " + request.getURI(), ex);
|
failure = new HandshakeFailureException("Uncaught failure for request " + request.getURI(), ex);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -244,7 +244,7 @@ public abstract class AbstractClientSockJsSession implements WebSocketSession {
|
||||||
this.webSocketHandler.afterConnectionEstablished(this);
|
this.webSocketHandler.afterConnectionEstablished(this);
|
||||||
this.connectFuture.set(this);
|
this.connectFuture.set(this);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
if (logger.isErrorEnabled()) {
|
if (logger.isErrorEnabled()) {
|
||||||
logger.error("WebSocketHandler.afterConnectionEstablished threw exception in " + this, ex);
|
logger.error("WebSocketHandler.afterConnectionEstablished threw exception in " + this, ex);
|
||||||
}
|
}
|
||||||
|
|
@ -293,7 +293,7 @@ public abstract class AbstractClientSockJsSession implements WebSocketSession {
|
||||||
try {
|
try {
|
||||||
this.webSocketHandler.handleMessage(this, new TextMessage(message));
|
this.webSocketHandler.handleMessage(this, new TextMessage(message));
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
logger.error("WebSocketHandler.handleMessage threw an exception on " + frame + " in " + this, ex);
|
logger.error("WebSocketHandler.handleMessage threw an exception on " + frame + " in " + this, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ public class RestTemplateXhrTransport extends AbstractXhrTransport {
|
||||||
getRestTemplate().execute(receiveUrl, HttpMethod.POST, requestCallback, responseExtractor);
|
getRestTemplate().execute(receiveUrl, HttpMethod.POST, requestCallback, responseExtractor);
|
||||||
requestCallback = requestCallbackAfterHandshake;
|
requestCallback = requestCallbackAfterHandshake;
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
if (!connectFuture.isDone()) {
|
if (!connectFuture.isDone()) {
|
||||||
connectFuture.setException(ex);
|
connectFuture.setException(ex);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -260,7 +260,7 @@ public class SockJsClient implements WebSocketClient, Lifecycle {
|
||||||
ServerInfo serverInfo = getServerInfo(sockJsUrlInfo, getHttpRequestHeaders(headers));
|
ServerInfo serverInfo = getServerInfo(sockJsUrlInfo, getHttpRequestHeaders(headers));
|
||||||
createRequest(sockJsUrlInfo, headers, serverInfo).connect(handler, connectFuture);
|
createRequest(sockJsUrlInfo, headers, serverInfo).connect(handler, connectFuture);
|
||||||
}
|
}
|
||||||
catch (Throwable exception) {
|
catch (Exception exception) {
|
||||||
if (logger.isErrorEnabled()) {
|
if (logger.isErrorEnabled()) {
|
||||||
logger.error("Initial SockJS \"Info\" request to server failed, url=" + url, exception);
|
logger.error("Initial SockJS \"Info\" request to server failed, url=" + url, exception);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -133,7 +133,7 @@ public class SockJsHttpRequestHandler
|
||||||
try {
|
try {
|
||||||
this.sockJsService.handleRequest(request, response, getSockJsPath(servletRequest), this.webSocketHandler);
|
this.sockJsService.handleRequest(request, response, getSockJsPath(servletRequest), this.webSocketHandler);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
throw new SockJsException("Uncaught failure in SockJS request, uri=" + request.getURI(), ex);
|
throw new SockJsException("Uncaught failure in SockJS request, uri=" + request.getURI(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -215,10 +215,10 @@ public class TransportHandlingSockJsService extends AbstractSockJsService implem
|
||||||
catch (HandshakeFailureException ex) {
|
catch (HandshakeFailureException ex) {
|
||||||
failure = ex;
|
failure = ex;
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
failure = new HandshakeFailureException("Uncaught failure for request " + request.getURI(), ex);
|
failure = new HandshakeFailureException("Uncaught failure for request " + request.getURI(), ex);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (failure != null) {
|
if (failure != null) {
|
||||||
chain.applyAfterHandshake(request, response, failure);
|
chain.applyAfterHandshake(request, response, failure);
|
||||||
throw failure;
|
throw failure;
|
||||||
|
|
@ -316,7 +316,7 @@ public class TransportHandlingSockJsService extends AbstractSockJsService implem
|
||||||
catch (SockJsException ex) {
|
catch (SockJsException ex) {
|
||||||
failure = ex;
|
failure = ex;
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
failure = new SockJsException("Uncaught failure for request " + request.getURI(), sessionId, ex);
|
failure = new SockJsException("Uncaught failure for request " + request.getURI(), sessionId, ex);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -72,7 +72,7 @@ public abstract class AbstractHttpReceivingTransportHandler extends AbstractTran
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
logger.error("Failed to read message", ex);
|
logger.error("Failed to read message", ex);
|
||||||
handleReadError(response, "Failed to read message(s)", sockJsSession.getId());
|
handleReadError(response, "Failed to read message(s)", sockJsSession.getId());
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ public class WebSocketTransportHandler extends AbstractTransportHandler
|
||||||
wsHandler = new SockJsWebSocketHandler(getServiceConfig(), wsHandler, sockJsSession);
|
wsHandler = new SockJsWebSocketHandler(getServiceConfig(), wsHandler, sockJsSession);
|
||||||
this.handshakeHandler.doHandshake(request, response, wsHandler, sockJsSession.getAttributes());
|
this.handshakeHandler.doHandshake(request, response, wsHandler, sockJsSession.getAttributes());
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
sockJsSession.tryCloseWithSockJsTransportError(ex, CloseStatus.SERVER_ERROR);
|
sockJsSession.tryCloseWithSockJsTransportError(ex, CloseStatus.SERVER_ERROR);
|
||||||
throw new SockJsTransportFailureException("WebSocket handshake failure", wsSession.getId(), ex);
|
throw new SockJsTransportFailureException("WebSocket handshake failure", wsSession.getId(), ex);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -324,7 +324,7 @@ public abstract class AbstractSockJsSession implements SockJsSession {
|
||||||
try {
|
try {
|
||||||
writeFrameInternal(frame);
|
writeFrameInternal(frame);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
logWriteFrameFailure(ex);
|
logWriteFrameFailure(ex);
|
||||||
try {
|
try {
|
||||||
// Force disconnect (so we won't try to send close frame)
|
// Force disconnect (so we won't try to send close frame)
|
||||||
|
|
@ -388,7 +388,7 @@ public abstract class AbstractSockJsSession implements SockJsSession {
|
||||||
undelivered.remove(0);
|
undelivered.remove(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
throw new SockJsMessageDeliveryException(this.id, undelivered, ex);
|
throw new SockJsMessageDeliveryException(this.id, undelivered, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ public class WebSocketServerSockJsSession extends AbstractSockJsSession implemen
|
||||||
scheduleHeartbeat();
|
scheduleHeartbeat();
|
||||||
this.openFrameSent = true;
|
this.openFrameSent = true;
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
tryCloseWithSockJsTransportError(ex, CloseStatus.SERVER_ERROR);
|
tryCloseWithSockJsTransportError(ex, CloseStatus.SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -186,7 +186,7 @@ public class WebSocketServerSockJsSession extends AbstractSockJsSession implemen
|
||||||
try {
|
try {
|
||||||
messages = getSockJsServiceConfig().getMessageCodec().decode(payload);
|
messages = getSockJsServiceConfig().getMessageCodec().decode(payload);
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Exception ex) {
|
||||||
logger.error("Broken data received. Terminating WebSocket connection abruptly", ex);
|
logger.error("Broken data received. Terminating WebSocket connection abruptly", ex);
|
||||||
tryCloseWithSockJsTransportError(ex, CloseStatus.BAD_DATA);
|
tryCloseWithSockJsTransportError(ex, CloseStatus.BAD_DATA);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue