diff --git a/flow-server/src/main/java/com/vaadin/flow/component/internal/UIInternals.java b/flow-server/src/main/java/com/vaadin/flow/component/internal/UIInternals.java index 1a5d6c8a4eb..7b58e5cc0f2 100644 --- a/flow-server/src/main/java/com/vaadin/flow/component/internal/UIInternals.java +++ b/flow-server/src/main/java/com/vaadin/flow/component/internal/UIInternals.java @@ -215,7 +215,7 @@ public List getParameters() { private byte[] lastProcessedMessageHash = null; - private String lastRequestResponse = "for(;;);[{}]"; + private String lastRequestResponse; private String contextRootRelativePath; diff --git a/flow-server/src/main/java/com/vaadin/flow/server/communication/ServerRpcHandler.java b/flow-server/src/main/java/com/vaadin/flow/server/communication/ServerRpcHandler.java index 7c52713daeb..4612fa50bcc 100644 --- a/flow-server/src/main/java/com/vaadin/flow/server/communication/ServerRpcHandler.java +++ b/flow-server/src/main/java/com/vaadin/flow/server/communication/ServerRpcHandler.java @@ -237,14 +237,14 @@ public ResynchronizationRequiredException() { } /** - * Exception thrown then the client side re-sent the same request. + * Exception thrown when the client side re-sends the same request. */ - public static class ResendPayloadException extends RuntimeException { + public static class ClientResentPayloadException extends RuntimeException { /** * Default constructor for the exception. */ - public ResendPayloadException() { + public ClientResentPayloadException() { super(); } } @@ -334,7 +334,7 @@ public void handleRpc(UI ui, String message, VaadinRequest request) "Received old duplicate message from the client. Expected: " + expectedId + ", got: " + requestId + ". Resending previous response."); - throw new ResendPayloadException(); + throw new ClientResentPayloadException(); } else if (rpcRequest.isUnloadBeaconRequest()) { getLogger().debug( "Ignoring unexpected message id from the client on UNLOAD request. " diff --git a/flow-server/src/main/java/com/vaadin/flow/server/communication/UidlRequestHandler.java b/flow-server/src/main/java/com/vaadin/flow/server/communication/UidlRequestHandler.java index f4b4efcd97d..f47e19362af 100644 --- a/flow-server/src/main/java/com/vaadin/flow/server/communication/UidlRequestHandler.java +++ b/flow-server/src/main/java/com/vaadin/flow/server/communication/UidlRequestHandler.java @@ -39,7 +39,7 @@ import com.vaadin.flow.server.VaadinService; import com.vaadin.flow.server.VaadinSession; import com.vaadin.flow.server.communication.ServerRpcHandler.InvalidUIDLSecurityKeyException; -import com.vaadin.flow.server.communication.ServerRpcHandler.ResendPayloadException; +import com.vaadin.flow.server.communication.ServerRpcHandler.ClientResentPayloadException; import com.vaadin.flow.server.communication.ServerRpcHandler.ResynchronizationRequiredException; import com.vaadin.flow.server.dau.DAUUtils; import com.vaadin.flow.server.dau.DauEnforcementException; @@ -137,7 +137,7 @@ public Optional synchronizedHandleRequest( try { getRpcHandler().handleRpc(uI, requestBody, request); writeUidl(uI, stringWriter, false); - } catch (ResendPayloadException e) { + } catch (ClientResentPayloadException e) { stringWriter.write(uI.getInternals().getLastRequestResponse()); } catch (JsonException e) { getLogger().error("Error writing JSON to response", e); diff --git a/flow-server/src/test/java/com/vaadin/flow/server/communication/ServerRpcHandlerTest.java b/flow-server/src/test/java/com/vaadin/flow/server/communication/ServerRpcHandlerTest.java index 8069d960406..6c8116a82ff 100644 --- a/flow-server/src/test/java/com/vaadin/flow/server/communication/ServerRpcHandlerTest.java +++ b/flow-server/src/test/java/com/vaadin/flow/server/communication/ServerRpcHandlerTest.java @@ -1,7 +1,6 @@ package com.vaadin.flow.server.communication; import java.io.IOException; -import java.io.Reader; import java.io.StringReader; import org.junit.Assert; @@ -99,7 +98,7 @@ public void handleRpc_resynchronize_throwsExceptionAndDirtiesTreeAndClearsDepend Mockito.verify(dependencyList).clearPendingSendToClient(); } - @Test(expected = ServerRpcHandler.ResendPayloadException.class) + @Test(expected = ServerRpcHandler.ClientResentPayloadException.class) public void handleRpc_duplicateMessage_throwsResendPayload() throws InvalidUIDLSecurityKeyException { String msg = "{\"" + ApplicationConstants.CLIENT_TO_SERVER_ID + "\":1}";