Skip to content

Commit

Permalink
Fix phrasing of error for handshake verion mismatches
Browse files Browse the repository at this point in the history
The parameters were never been filled because the server does not produce its version in the handshake message. This
could be fixed, but comes with BC concerns so I just fixed the strings for now.
  • Loading branch information
kwvanderlinde committed May 23, 2024
1 parent 4b31743 commit 787cd61
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
11 changes: 10 additions & 1 deletion src/main/java/net/rptools/maptool/server/ClientHandshake.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
import java.util.function.BiConsumer;
Expand Down Expand Up @@ -91,7 +92,15 @@ public ClientHandshake(MapToolClient client, Connection connection) {

@Override
public void whenComplete(BiConsumer<? super Void, ? super Throwable> callback) {
stage = stage.whenComplete(callback);
stage =
stage.whenComplete(
(result, error) -> {
// Hand back the original exception, not the wrapped one.
if (error instanceof CompletionException e) {
error = e.getCause();
}
callback.accept(result, error);
});
}

private void setCurrentState(State state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ GridlessGrid.error.notLoaded = Could not load gridless grid footprints.
Handshake.msg.duplicateName = Someone is already using that player name. Please choose another name and try again.
Handshake.msg.wrongPassword = You entered the wrong password. Please try again.
Handshake.msg.unknownPlayer = Player {0} is unknown.
Handshake.msg.wrongVersion = The versions used do not match. You are trying to connect a client running version {0} to a server running version {1}.<br> Please update your client to the correct version.
Handshake.msg.wrongVersion = The versions used do not match. You are trying to connect a client to a server running a different version.<br> Please update your client to the correct version.
Handshake.msg.failedLogin = Failed login attempt from {0}, errors decoding handshake follow.
Handshake.msg.failedLoginDecode = Failed decoding handshake with password.
Handshake.msg.encodeInitFail = Failed to initialize encoding for handshake.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ GridlessGrid.error.notLoaded = Could not load gridless grid footprints.
Handshake.msg.duplicateName = Someone is already using that player name. Please choose another name and try again.
Handshake.msg.wrongPassword = You entered the wrong password. Please try again.
Handshake.msg.unknownPlayer = Player {0} is unknown.
Handshake.msg.wrongVersion = The versions used do not match. You are trying to connect a client running version {0} to a server running version {1}.<br> Please update your client to the correct version.
Handshake.msg.wrongVersion = The versions used do not match. You are trying to connect a client to a server running a different version.<br> Please update your client to the correct version.
Handshake.msg.failedLogin = Failed login attempt from {0}, errors decoding handshake follow.
Handshake.msg.failedLoginDecode = Failed decoding handshake with password.
Handshake.msg.encodeInitFail = Failed to initialize encoding for handshake.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ GridlessGrid.error.notLoaded = Could not load gridless grid footprints.
Handshake.msg.duplicateName = Someone is already using that player name. Please choose another name and try again.
Handshake.msg.wrongPassword = You entered the wrong password. Please try again.
Handshake.msg.unknownPlayer = Player {0} is unknown.
Handshake.msg.wrongVersion = The versions used do not match. You are trying to connect a client running version {0} to a server running version {1}.<br> Please update your client to the correct version.
Handshake.msg.wrongVersion = The versions used do not match. You are trying to connect a client to a server running a different version.<br> Please update your client to the correct version.
Handshake.msg.failedLogin = Failed login attempt from {0}, errors decoding handshake follow.
Handshake.msg.failedLoginDecode = Failed decoding handshake with password.
Handshake.msg.encodeInitFail = Failed to initialize encoding for handshake.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ GridlessGrid.error.notLoaded = Could not load gridless grid footprints.
Handshake.msg.duplicateName = Someone is already using that player name. Please choose another name and try again.
Handshake.msg.wrongPassword = You entered the wrong password. Please try again.
Handshake.msg.unknownPlayer = Player {0} is unknown.
Handshake.msg.wrongVersion = The versions used do not match. You are trying to connect a client running version {0} to a server running version {1}.<br> Please update your client to the correct version.
Handshake.msg.wrongVersion = The versions used do not match. You are trying to connect a client to a server running a different version.<br> Please update your client to the correct version.
Handshake.msg.failedLogin = Failed login attempt from {0}, errors decoding handshake follow.
Handshake.msg.failedLoginDecode = Failed decoding handshake with password.
Handshake.msg.encodeInitFail = Failed to initialize encoding for handshake.
Expand Down

0 comments on commit 787cd61

Please sign in to comment.