From b7ee3ac8b0510defff27b11185c2148392a1c174 Mon Sep 17 00:00:00 2001 From: le-maire Date: Fri, 3 Nov 2023 11:23:54 +0100 Subject: [PATCH] fix: verrification des matches dans regex pour le status --- .../theses_batch_indexation/dto/these/TheseMappee.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/abes/theses_batch_indexation/dto/these/TheseMappee.java b/src/main/java/fr/abes/theses_batch_indexation/dto/these/TheseMappee.java index b9b9e07..2de5f63 100644 --- a/src/main/java/fr/abes/theses_batch_indexation/dto/these/TheseMappee.java +++ b/src/main/java/fr/abes/theses_batch_indexation/dto/these/TheseMappee.java @@ -240,11 +240,13 @@ public TheseMappee(Mets mets, List oaiSets) { final String regex = ".*\\/([0-9,A-Z]*)"; final String urlperene = mets.getDmdSec().stream().filter(d -> d.getMdWrap().getXmlData().getStarGestion() != null).findFirst().orElse(null) .getMdWrap().getXmlData().getStarGestion().getTraitements().getSorties().getDiffusion().getUrlPerenne(); - final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); - final Matcher matcher = pattern.matcher(urlperene); + if (urlperene != null) { + final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); + final Matcher matcher = pattern.matcher(urlperene); - if (isNnt(matcher.group(1))) { - status = "soutenue"; + if (matcher.matches() && isNnt(matcher.group(1))) { + status = "soutenue"; + } } } catch (NullPointerException e) { log.error("PB pour status de " + nnt + "," + e.getMessage());