From d7f2c458b9f9ebf8c5ea6b4c8e213b9c77af6f97 Mon Sep 17 00:00:00 2001 From: Github Action Date: Thu, 28 Mar 2024 09:58:39 +0000 Subject: [PATCH 1/3] Version 0.0.10-SNAPSHOT [skip ci] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8230c5d..894286f 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ fr.abes sudoc - 0.0.9 + 0.0.10-SNAPSHOT jar sudoc webservices de récupération de ppns dans le sudoc From 10823aa70b06f9f5c0f759bf97a4438e96e51ccf Mon Sep 17 00:00:00 2001 From: SamuelQuetin Date: Thu, 28 Mar 2024 16:02:36 +0100 Subject: [PATCH 2/3] =?UTF-8?q?gestion=20cas=20"Aucune=20notice=20ne=20cor?= =?UTF-8?q?respond=20=C3=A0=20la=20recherche"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/abes/sudoc/exception/ExceptionControllerHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/abes/sudoc/exception/ExceptionControllerHandler.java b/src/main/java/fr/abes/sudoc/exception/ExceptionControllerHandler.java index cbd0ddb..b86dff0 100644 --- a/src/main/java/fr/abes/sudoc/exception/ExceptionControllerHandler.java +++ b/src/main/java/fr/abes/sudoc/exception/ExceptionControllerHandler.java @@ -16,6 +16,7 @@ import java.io.IOException; + @ControllerAdvice @Order(Ordered.HIGHEST_PRECEDENCE) @Slf4j @@ -58,13 +59,16 @@ protected ResponseEntity handleHttpRequestMethodNotSupported(HttpRequest @ExceptionHandler(ZoneNotFoundException.class) protected ResponseEntity handleZoneNotFoundException(ZoneNotFoundException ex) { String error = "Erreur dans la notice récupérée"; + log.error(ex.getLocalizedMessage()); return buildResponseEntity(new ApiReturnError(HttpStatus.BAD_REQUEST, error, ex)); } + @ExceptionHandler(IOException.class) protected ResponseEntity handleIOException(IOException ex) { String error = "Erreur dans l'accès aux données"; - return buildResponseEntity(new ApiReturnError(HttpStatus.NO_CONTENT, error, ex)); + log.error(ex.getLocalizedMessage()); + return buildResponseEntity(new ApiReturnError(HttpStatus.BAD_REQUEST, error, ex)); } /** From 6eb93027344aa1301a30b04eebe7db4b8edf3aeb Mon Sep 17 00:00:00 2001 From: SamuelQuetin Date: Tue, 16 Apr 2024 15:35:31 +0200 Subject: [PATCH 3/3] ajout gestion zone 008 inexsitant --- src/main/java/fr/abes/sudoc/entity/notice/NoticeXml.java | 5 ++++- .../java/fr/abes/sudoc/entity/notice/NoticesBibioTest.java | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/abes/sudoc/entity/notice/NoticeXml.java b/src/main/java/fr/abes/sudoc/entity/notice/NoticeXml.java index 771aefa..e3a82f1 100644 --- a/src/main/java/fr/abes/sudoc/entity/notice/NoticeXml.java +++ b/src/main/java/fr/abes/sudoc/entity/notice/NoticeXml.java @@ -52,7 +52,10 @@ public boolean isNoticeElectronique() { return get008().startsWith("O"); } - public boolean isNoticeImprimee() { + public boolean isNoticeImprimee() throws ZoneNotFoundException { + if(get008() == null){ + throw new ZoneNotFoundException("La Zone 008 n'existe pas"); + } return get008().startsWith("A"); } diff --git a/src/test/java/fr/abes/sudoc/entity/notice/NoticesBibioTest.java b/src/test/java/fr/abes/sudoc/entity/notice/NoticesBibioTest.java index b249ce6..9c7919c 100644 --- a/src/test/java/fr/abes/sudoc/entity/notice/NoticesBibioTest.java +++ b/src/test/java/fr/abes/sudoc/entity/notice/NoticesBibioTest.java @@ -1,5 +1,6 @@ package fr.abes.sudoc.entity.notice; +import fr.abes.sudoc.exception.ZoneNotFoundException; import org.assertj.core.util.Lists; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -44,7 +45,7 @@ void isNoticeElectronique() { } @Test - void isNoticeImprimee() { + void isNoticeImprimee() throws ZoneNotFoundException { NoticeXml notice = new NoticeXml(); Controlfield controlfield = new Controlfield(); controlfield.setTag("008");