Fix: Checkstyle Line length for MR Pipeline

This commit is contained in:
Jona Walpert
2026-04-12 00:54:10 +02:00
parent dac4dcfdbe
commit ca818d9892
3 changed files with 24 additions and 37 deletions
@@ -14,20 +14,13 @@ import java.util.Optional;
/** /**
* Handler for the `RAISE` command. * Handler for the `RAISE` command.
* *
* <p> * <p>This handler validates the request (amount >= 0), resolves the user and target lobby (by
* This handler validates the request (amount >= 0), resolves the user and * `GAME_ID` when provided or by session username otherwise), checks that a game is running and then
* target lobby (by
* `GAME_ID` when provided or by session username otherwise), checks that a game
* is running and then
* forwards the action to the {@code GameController}. * forwards the action to the {@code GameController}.
* *
* <p> * <p>On failure the handler dispatches an {@link ErrorResponse} with an appropriate error code
* On failure the handler dispatches an {@link ErrorResponse} with an * (e.g. {@code INVALID_AMOUNT}, {@code NOT_IN_LOBBY}, {@code LOBBY_NOT_FOUND}, {@code
* appropriate error code * GAME_NOT_STARTED}, {@code GAME_ACTION_FAILED}). On success it dispatches an {@link OkResponse}.
* (e.g. {@code INVALID_AMOUNT}, {@code NOT_IN_LOBBY}, {@code LOBBY_NOT_FOUND},
* {@code
* GAME_NOT_STARTED}, {@code GAME_ACTION_FAILED}). On success it dispatches an
* {@link OkResponse}.
*/ */
public class PlayerRaiseHandler extends CommandHandler<PlayerRaiseRequest> { public class PlayerRaiseHandler extends CommandHandler<PlayerRaiseRequest> {
private final UserRegistry userRegistry; private final UserRegistry userRegistry;
@@ -36,11 +29,9 @@ public class PlayerRaiseHandler extends CommandHandler<PlayerRaiseRequest> {
/** /**
* Creates a new {@code PlayerRaiseHandler}. * Creates a new {@code PlayerRaiseHandler}.
* *
* @param responseDispatcher dispatcher used to send responses back to the * @param responseDispatcher dispatcher used to send responses back to the client
* client
* @param userRegistry registry to resolve users from session ids * @param userRegistry registry to resolve users from session ids
* @param lobbyManager manager used to lookup lobbies and their game * @param lobbyManager manager used to lookup lobbies and their game controllers
* controllers
*/ */
public PlayerRaiseHandler( public PlayerRaiseHandler(
ResponseDispatcher responseDispatcher, ResponseDispatcher responseDispatcher,
@@ -52,10 +43,8 @@ public class PlayerRaiseHandler extends CommandHandler<PlayerRaiseRequest> {
} }
/** /**
* Execute the raise request: validate parameters, resolve lobby and game, and * Execute the raise request: validate parameters, resolve lobby and game, and forward the raise
* forward the raise * action to the game controller. Sends an {@link ErrorResponse} on failure or an {@link
* action to the game controller. Sends an {@link ErrorResponse} on failure or
* an {@link
* OkResponse} on success. * OkResponse} on success.
* *
* @param request the parsed {@link PlayerRaiseRequest} * @param request the parsed {@link PlayerRaiseRequest}
@@ -71,8 +60,8 @@ public class PlayerRaiseHandler extends CommandHandler<PlayerRaiseRequest> {
return; return;
} }
Optional<ch.unibas.dmi.dbis.cs108.casono.server.domain.user.User> opt = userRegistry Optional<ch.unibas.dmi.dbis.cs108.casono.server.domain.user.User> opt =
.getBySessionId(request.getSessionId()); userRegistry.getBySessionId(request.getSessionId());
if (opt.isEmpty()) { if (opt.isEmpty()) {
responseDispatcher.dispatch( responseDispatcher.dispatch(
new ErrorResponse(request.getContext(), "NOT_LOGGED_IN", "User not logged in")); new ErrorResponse(request.getContext(), "NOT_LOGGED_IN", "User not logged in"));
@@ -82,7 +71,8 @@ public class PlayerRaiseHandler extends CommandHandler<PlayerRaiseRequest> {
String username = opt.get().getName(); String username = opt.get().getName();
Integer gameId = request.getGameId(); Integer gameId = request.getGameId();
var lobby = (gameId != null) var lobby =
(gameId != null)
? lobbyManager.getLobby(LobbyId.of(gameId)) ? lobbyManager.getLobby(LobbyId.of(gameId))
: lobbyManager.getLobbyByUsername(username); : lobbyManager.getLobbyByUsername(username);
@@ -7,9 +7,7 @@ import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.accessor.
/** /**
* Parser for the `RAISE` command. * Parser for the `RAISE` command.
* *
* <p> * <p>Parses the request parameters and builds a {@link PlayerRaiseRequest}. Expected parameters:
* Parses the request parameters and builds a {@link PlayerRaiseRequest}.
* Expected parameters:
* *
* <ul> * <ul>
* <li>`GAME_ID` (optional) - numeric id of the lobby/game to target * <li>`GAME_ID` (optional) - numeric id of the lobby/game to target
@@ -19,7 +17,8 @@ import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.accessor.
public class PlayerRaiseParser implements CommandParser<PlayerRaiseRequest> { public class PlayerRaiseParser implements CommandParser<PlayerRaiseRequest> {
@Override @Override
public PlayerRaiseRequest parse(PrimitiveRequest primitiveRequest) { public PlayerRaiseRequest parse(PrimitiveRequest primitiveRequest) {
RequestParameterAccessor accessor = new RequestParameterAccessor(primitiveRequest.parameters()); RequestParameterAccessor accessor =
new RequestParameterAccessor(primitiveRequest.parameters());
Integer gameId = null; Integer gameId = null;
try { try {
@@ -6,9 +6,7 @@ import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.RequestCo
/** /**
* Request for the `RAISE` command. * Request for the `RAISE` command.
* *
* <p> * <p>Contains the optional target `gameId` and the `amount` the player wants to raise.
* Contains the optional target `gameId` and the `amount` the player wants to
* raise.
*/ */
public class PlayerRaiseRequest extends Request { public class PlayerRaiseRequest extends Request {
private final Integer gameId; private final Integer gameId;