From 36e579cd07e66389f900451c3943e03b9c0e6d26 Mon Sep 17 00:00:00 2001 From: Santiago Pericasgeertsen Date: Mon, 20 Nov 2023 09:32:51 -0500 Subject: [PATCH] Assume WsConfig will always be present with WebSocket support on the classpath. Signed-off-by: Santiago Pericasgeertsen --- .../java/io/helidon/webserver/websocket/WsConnection.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConnection.java b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConnection.java index a2fdba064b9..32d3f442d88 100644 --- a/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConnection.java +++ b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConnection.java @@ -84,7 +84,7 @@ private WsConnection(ConnectionContext ctx, .stream() .filter(p -> p instanceof WsConfig) .findFirst() - .orElse(null); + .orElseThrow(() -> new InternalError("Unable to find WebSocket config")); } /** @@ -253,9 +253,7 @@ private boolean processFrame(ClientWsFrame frame) { private ClientWsFrame readFrame() { try { - int maxFrameLength = wsConfig != null ? wsConfig.maxFrameLength() - : Integer.parseInt(MAX_FRAME_LENGTH); - return ClientWsFrame.read(ctx, dataReader, maxFrameLength); + return ClientWsFrame.read(ctx, dataReader, wsConfig.maxFrameLength()); } catch (DataReader.InsufficientDataAvailableException e) { throw new CloseConnectionException("Socket closed by the other side", e); } catch (WsCloseException e) {