remove null values from board.map

This commit is contained in:
djmil 2023-12-05 15:04:03 +01:00
parent 4428fdd25f
commit f9485be59d
2 changed files with 4 additions and 1 deletions

View File

@ -48,7 +48,6 @@ public class GameProposalController {
final HoldingIdentity gpReceiver = holdingIdentityResolver.getByUsername(gpRequest.opponentName()); final HoldingIdentity gpReceiver = holdingIdentityResolver.getByUsername(gpRequest.opponentName());
final Stone.Color gpReceiverColor = gpRequest.opponentColor(); final Stone.Color gpReceiverColor = gpRequest.opponentColor();
// GiteaIssue #4: Exception handling
GameView gameStateView = cordaClient.gameProposalCreate( GameView gameStateView = cordaClient.gameProposalCreate(
gpSender, gpSender,
gpReceiver, gpReceiver,

View File

@ -4,6 +4,7 @@ import static java.util.Objects.requireNonNull;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -110,6 +111,9 @@ public class CordaClient {
public GameView gameProposalCreate(HoldingIdentity issuer, HoldingIdentity acquier, Stone.Color acquierColor, public GameView gameProposalCreate(HoldingIdentity issuer, HoldingIdentity acquier, Stone.Color acquierColor,
Map<Integer, Stone> board, String message) throws RspFailureException { Map<Integer, Stone> board, String message) throws RspFailureException {
board.values().removeIf(Objects::isNull); // '5=BLACK.MAN, 6=null, 7=BLACK.MAN, 8=null, 9=BLACK.MAN, 10=BLACK.MAN'
final RequestBody requestBody = new RequestBody( final RequestBody requestBody = new RequestBody(
"gp.create-" + UUID.randomUUID(), "gp.create-" + UUID.randomUUID(),
"djmil.cordacheckers.gameproposal.CreateFlow", "djmil.cordacheckers.gameproposal.CreateFlow",