Skip to content

Commit

Permalink
FEAT : CDE-46-exclusion-de-packages-ou-de-providers
Browse files Browse the repository at this point in the history
     - refactor du contrôle sur le filename du fichier dans la méthode detectFileName() (CheckFiles.java)
  • Loading branch information
EryneKL committed Jan 4, 2024
1 parent 3311e59 commit 15e2fbc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/fr/abes/kbart2kafka/utils/CheckFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 15e2fbc

Please sign in to comment.