From 15e2fbcfd458454fec82ffedb4972550b4ec0cfe Mon Sep 17 00:00:00 2001 From: EryneKL <97091460+EryneKL@users.noreply.github.com> Date: Thu, 4 Jan 2024 11:11:38 +0100 Subject: [PATCH] =?UTF-8?q?FEAT=20:=20CDE-46-exclusion-de-packages-ou-de-p?= =?UTF-8?q?roviders=20=20=20=20=20=20-=20refactor=20du=20contr=C3=B4le=20s?= =?UTF-8?q?ur=20le=20filename=20du=20fichier=20dans=20la=20m=C3=A9thode=20?= =?UTF-8?q?detectFileName()=20(CheckFiles.java)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/fr/abes/kbart2kafka/utils/CheckFiles.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/abes/kbart2kafka/utils/CheckFiles.java b/src/main/java/fr/abes/kbart2kafka/utils/CheckFiles.java index 970d952..9b5e0e0 100644 --- a/src/main/java/fr/abes/kbart2kafka/utils/CheckFiles.java +++ b/src/main/java/fr/abes/kbart2kafka/utils/CheckFiles.java @@ -14,10 +14,10 @@ public class CheckFiles { public static Boolean detectFileName(File file) throws IllegalFileFormatException { String filename = file.getName(); - if (!filename.matches("([a-zA-Z0-9\\-]+_){3}(\\d{4}-\\d{2}-\\d{2})+(_FORCE)?+(.tsv)$") && !filename.matches("([a-zA-Z0-9\\-]+_){3}(\\d{4}-\\d{2}-\\d{2})+(_BYPASS)?+(.tsv)$")) { + if (!filename.matches("([a-zA-Z0-9\\-]+_){3}(\\d{4}-\\d{2}-\\d{2})+(_FORCE|_BYPASS)?+(.tsv)$")) { log.error("Message envoyé : {}", "Le nom du fichier n'est pas correct"); throw new IllegalFileFormatException("Le nom du fichier "+ filename +" n'est pas correct"); - } else return filename.matches("([a-zA-Z0-9\\-]+_){3}(\\d{4}-\\d{2}-\\d{2})+(_BYPASS)?+(.tsv)$"); + } else return filename.matches("([a-zA-Z0-9\\-]+_){3}(\\d{4}-\\d{2}-\\d{2})+(_BYPASS)+(.tsv)$"); } public static void detectProvider(File file) throws IllegalProviderException {