Skip to content

Commit

Permalink
Rename exception, remove initial value.
Browse files Browse the repository at this point in the history
  • Loading branch information
caalador committed Nov 26, 2024
1 parent 09fd5d5 commit 5e7c145
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public List<Object> getParameters() {

private byte[] lastProcessedMessageHash = null;

private String lastRequestResponse = "for(;;);[{}]";
private String lastRequestResponse;

private String contextRootRelativePath;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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. "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -137,7 +137,7 @@ public Optional<ResponseWriter> 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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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}";
Expand Down

0 comments on commit 5e7c145

Please # to comment.