diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignController.java b/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignController.java index 637ce581..082cb6c7 100644 --- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignController.java +++ b/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignController.java @@ -234,7 +234,7 @@ private CampaignOngoingDto convertToCampaignOngoingDto(Campaign campaign) { } private boolean isCampaignInType(Campaign c, String campaignType) { - if (campaignType.isEmpty()) + if (StringUtils.isEmpty(campaignType)) return true; if (campaignType.equalsIgnoreCase(V3.name())) return parametersService.findSuitableParameterValue(c, Parameters.ParameterEnum.URL_TYPE).equalsIgnoreCase(campaignType) diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/util/ParamValidator.java b/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/util/ParamValidator.java index 47644d67..7f962058 100644 --- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/util/ParamValidator.java +++ b/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/util/ParamValidator.java @@ -13,18 +13,21 @@ public class ParamValidator { + private ParamValidator() { + throw new IllegalStateException("Validation class"); + } public static void validateParams(ParamsDto paramsDto) { if (paramsDto.getParamId().equalsIgnoreCase(Parameters.ParameterEnum.URL_TYPE.name()) && Arrays.stream(UrlTypeEnum.values()).noneMatch(p -> p.name().equals(paramsDto.getParamValue()))) { - throw new NotMatchException(String.format("Only %s are valid values for URL_TYPE", Arrays.stream(UrlTypeEnum.values()).map(item -> item.name()) + throw new NotMatchException(String.format("Only %s are valid values for URL_TYPE", Arrays.stream(UrlTypeEnum.values()).map(Enum::name) .collect(joining(" ")))); } if (paramsDto.getParamId().equalsIgnoreCase(Parameters.ParameterEnum.URL_REDIRECTION.name()) && Arrays.stream(UrlRedirectionEnum.values()).noneMatch(p -> p.name().equals(paramsDto.getParamValue()))) { - throw new NotMatchException(String.format("Only %s are valid values for URL_REDIRECTION", Arrays.stream(UrlRedirectionEnum.values()).map(item -> item.name()) + throw new NotMatchException(String.format("Only %s are valid values for URL_REDIRECTION", Arrays.stream(UrlRedirectionEnum.values()).map(Enum::name) .collect(joining(" ")))); } if (paramsDto.getParamId().equalsIgnoreCase(Parameters.ParameterEnum.MAIL_ASSISTANCE.name())