diff --git a/src/main/java/com/epam/reportportal/extension/monday/command/connection/TestConnectionCommand.java b/src/main/java/com/epam/reportportal/extension/monday/command/connection/TestConnectionCommand.java index f82cf14..d93708a 100644 --- a/src/main/java/com/epam/reportportal/extension/monday/command/connection/TestConnectionCommand.java +++ b/src/main/java/com/epam/reportportal/extension/monday/command/connection/TestConnectionCommand.java @@ -16,6 +16,7 @@ package com.epam.reportportal.extension.monday.command.connection; +import static com.epam.reportportal.rules.exception.ErrorType.BAD_REQUEST_ERROR; import static com.epam.reportportal.rules.exception.ErrorType.UNABLE_INTERACT_WITH_INTEGRATION; import static java.util.Optional.ofNullable; @@ -60,10 +61,20 @@ public Boolean executeCommand(Integration integration, Map param String boardId = MondayProperties.PROJECT.getParam(integrationParams); + verifyBoardId(boardId); + MondayClient mondayClient = mondayClientProvider.provide(integrationParams); return mondayClient.getBoard(boardId).map(b -> Boolean.TRUE).orElseThrow( () -> new ReportPortalException(UNABLE_INTERACT_WITH_INTEGRATION, "Board with provided id {} not found", boardId)); } + + private void verifyBoardId(String boardId) { + try { + Long.parseLong(boardId); + } catch (NumberFormatException e) { + throw new ReportPortalException(BAD_REQUEST_ERROR, "Invalid Board ID"); + } + } }