From ffa7ad949e35fadaf2300ab1ac9ce10a172507f0 Mon Sep 17 00:00:00 2001 From: GtanSndil Date: Wed, 20 May 2026 16:19:32 +0200 Subject: [PATCH 1/6] pom: upgrade springboot --- pom.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index dfb97980..e5d32d46 100644 --- a/pom.xml +++ b/pom.xml @@ -6,13 +6,13 @@ org.springframework.boot spring-boot-starter-parent - 3.5.13 + 4.0.6 jar fr.insee.rmes magma - 1.4.18 + 1.4.19 magma Metadata management API @@ -35,11 +35,11 @@ - - org.assertj - assertj-core - 3.27.7 - + + + + + org.springframework.boot From 1cd4d67570f5509377e9665280e9fdbb1865890c Mon Sep 17 00:00:00 2001 From: GtanSndil Date: Fri, 22 May 2026 10:24:31 +0200 Subject: [PATCH 2/6] chore: --- pom.xml | 4 ++-- .../SecurityConfigWithAccessControl.java | 6 ++--- .../rmes/controller/DataSetResources.java | 16 ++++++------- .../DataSetResourcesIntegrationTest.java | 23 ++++--------------- .../structures/StructuresImplTest.java | 1 - 5 files changed, 18 insertions(+), 32 deletions(-) diff --git a/pom.xml b/pom.xml index e5d32d46..c6cdb8d0 100644 --- a/pom.xml +++ b/pom.xml @@ -43,11 +43,11 @@ org.springframework.boot - spring-boot-starter-web + spring-boot-starter-webmvc org.springframework.boot - spring-boot-starter-test + spring-boot-starter-webmvc-test com.vaadin.external.google diff --git a/src/main/java/fr/insee/rmes/configuration/SecurityConfigWithAccessControl.java b/src/main/java/fr/insee/rmes/configuration/SecurityConfigWithAccessControl.java index 0bc53da8..ed82d0eb 100644 --- a/src/main/java/fr/insee/rmes/configuration/SecurityConfigWithAccessControl.java +++ b/src/main/java/fr/insee/rmes/configuration/SecurityConfigWithAccessControl.java @@ -11,7 +11,7 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; import org.springframework.security.web.SecurityFilterChain; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; +import org.springframework.security.web.servlet.util.matcher.PathPatternRequestMatcher; import org.springframework.security.web.util.matcher.RequestMatcher; import java.util.Arrays; @@ -54,10 +54,10 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .authorizeHttpRequests(authorize -> authorize.requestMatchers( Arrays.stream(whiteList) .filter(not(String::isEmpty)) - .map(AntPathRequestMatcher::antMatcher) + .map(pattern -> PathPatternRequestMatcher.withDefaults().matcher(pattern)) .toArray(RequestMatcher[]::new) ).permitAll() - .requestMatchers(AntPathRequestMatcher.antMatcher(HttpMethod.PATCH, "/dataset/**")).hasAnyRole(administrateurRole, gestionnaireDataset) + .requestMatchers(PathPatternRequestMatcher.withDefaults().matcher(HttpMethod.PATCH, "/dataset/**")).hasAnyRole(administrateurRole, gestionnaireDataset) .requestMatchers(HttpMethod.OPTIONS).permitAll() .anyRequest().authenticated() ) diff --git a/src/main/java/fr/insee/rmes/controller/DataSetResources.java b/src/main/java/fr/insee/rmes/controller/DataSetResources.java index bf18fbec..19c71824 100644 --- a/src/main/java/fr/insee/rmes/controller/DataSetResources.java +++ b/src/main/java/fr/insee/rmes/controller/DataSetResources.java @@ -16,7 +16,7 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; -import org.apache.http.HttpStatus; +import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; @@ -57,9 +57,9 @@ public ResponseEntity getListDatasets(@RequestParam(required = false) @P } String jsonResult = dataSetsServices.getListDataSets(dateMiseAJour); if (jsonResult.isEmpty()) { - return ResponseEntity.status(HttpStatus.SC_NOT_FOUND).build(); + return ResponseEntity.status(HttpStatus.NOT_FOUND).build(); } else { - return ResponseEntity.status(HttpStatus.SC_OK).body(jsonResult); + return ResponseEntity.status(HttpStatus.OK).body(jsonResult); } } @@ -75,18 +75,18 @@ public ResponseEntity getDataSetByID(@PathVariable("id") String id, if (!boolDateMiseAJour) { String jsonResult = dataSetsServices.getDataSetByID(id); if (jsonResult.isEmpty()) { - return ResponseEntity.status(HttpStatus.SC_NOT_FOUND).build(); + return ResponseEntity.status(HttpStatus.NOT_FOUND).build(); } else { - return ResponseEntity.status(HttpStatus.SC_OK).body(jsonResult); + return ResponseEntity.status(HttpStatus.OK).body(jsonResult); } } // Sinon, on renvoie juste la date MiseAJour else { String jsonResult = dataSetsServices.getDataSetByIDSummary(id); if (jsonResult.isEmpty()) { - return ResponseEntity.status(HttpStatus.SC_NOT_FOUND).build(); + return ResponseEntity.status(HttpStatus.NOT_FOUND).build(); } else { - return ResponseEntity.status(HttpStatus.SC_OK).body(jsonResult); + return ResponseEntity.status(HttpStatus.OK).body(jsonResult); } } @@ -112,7 +112,7 @@ public ResponseEntity patchDataSetDistributionsByIdNombreObservations( @AuthenticationPrincipal Object principal ) throws RmesException, MalformedURLException { if (token == null){ - return ResponseEntity.status(HttpStatus.SC_UNAUTHORIZED).build(); + return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build(); } return this.dataSetsServices.patchDataset(datasetId,stringPatchDataset,token, this.userDecoder.fromPrincipal(principal)); } diff --git a/src/test/java/fr/insee/rmes/controller/DataSetResourcesIntegrationTest.java b/src/test/java/fr/insee/rmes/controller/DataSetResourcesIntegrationTest.java index e678a312..a48d8451 100644 --- a/src/test/java/fr/insee/rmes/controller/DataSetResourcesIntegrationTest.java +++ b/src/test/java/fr/insee/rmes/controller/DataSetResourcesIntegrationTest.java @@ -2,20 +2,16 @@ import com.nimbusds.jose.shaded.gson.JsonArray; import com.nimbusds.jose.shaded.gson.JsonObject; -import fr.insee.rmes.utils.config.Config; -import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.TestConfiguration; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.boot.test.web.client.MockServerRestClientCustomizer; +import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Profile; -import org.springframework.http.MediaType; import org.springframework.security.oauth2.jwt.Jwt; import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; import org.springframework.web.client.RestClient; @@ -23,11 +19,6 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.when; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.header; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; -import static org.springframework.test.web.client.response.MockRestResponseCreators.withNoContent; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @SpringBootTest( properties = { "fr.insee.rmes.magma.force.ssl=false", @@ -56,12 +47,10 @@ @AutoConfigureMockMvc class DataSetResourcesIntegrationTest { - static final MockServerRestClientCustomizer customizer=new MockServerRestClientCustomizer(); - @Autowired MockMvc mockMvc; - @MockBean + @MockitoBean private JwtDecoder jwtDecoder; @@ -136,10 +125,8 @@ private static JsonObject jsonRoles(List roles) { @Profile("test") static class AdditionalConfigurationFotThisTest { @Bean - public RestClient restClient(Config config) { - var builder = RestClient.builder(); - customizer.customize(builder); - return builder.build(); + public RestClient restClient() { + return RestClient.builder().build(); } } diff --git a/src/test/java/fr/insee/rmes/services/structures/StructuresImplTest.java b/src/test/java/fr/insee/rmes/services/structures/StructuresImplTest.java index 4aa4eec8..58119984 100644 --- a/src/test/java/fr/insee/rmes/services/structures/StructuresImplTest.java +++ b/src/test/java/fr/insee/rmes/services/structures/StructuresImplTest.java @@ -24,7 +24,6 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; import static org.mockito.Mockito.when; -@Nested @ExtendWith(MockitoExtension.class) class StructuresImplTest { From ec1321a1aeb2c789cd1727c847c74a5b069cd3f4 Mon Sep 17 00:00:00 2001 From: GtanSndil Date: Fri, 22 May 2026 10:29:31 +0200 Subject: [PATCH 3/6] chore: delete overload of tomcat dependency --- pom.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index c6cdb8d0..1df2f7e7 100644 --- a/pom.xml +++ b/pom.xml @@ -23,10 +23,7 @@ 21 20251224 5.1.5 - 2.8.9 - - 10.1.55 - + 3.0.3 0.8.14 inseefr https://sonarcloud.io From eef8ac68d40324f57708cb70b15cc66f8f4f9c3e Mon Sep 17 00:00:00 2001 From: GtanSndil Date: Fri, 22 May 2026 11:37:04 +0200 Subject: [PATCH 4/6] chore; jackson2->jackson3 --- .../rmes/controller/CodeListsResources.java | 4 +-- .../rmes/controller/DataSetResources.java | 8 +++--- .../rmes/controller/StructuresResources.java | 6 ++--- .../rmes/services/datasets/DataSetsImpl.java | 25 ++++++++++--------- .../services/datasets/DataSetsServices.java | 9 ++++--- .../services/structures/StructuresImpl.java | 11 ++++---- .../structures/StructuresServices.java | 6 ++--- 7 files changed, 36 insertions(+), 33 deletions(-) diff --git a/src/main/java/fr/insee/rmes/controller/CodeListsResources.java b/src/main/java/fr/insee/rmes/controller/CodeListsResources.java index 73e2ea9d..76ac0e39 100644 --- a/src/main/java/fr/insee/rmes/controller/CodeListsResources.java +++ b/src/main/java/fr/insee/rmes/controller/CodeListsResources.java @@ -1,6 +1,6 @@ package fr.insee.rmes.controller; -import com.fasterxml.jackson.core.JsonProcessingException; +import tools.jackson.core.JacksonException; import fr.insee.rmes.modelSwagger.codeList.AllListCodeModelSwagger; import fr.insee.rmes.modelSwagger.codeList.ListCodeByIdModelSwagger; import fr.insee.rmes.services.codelists.CodeListsServices; @@ -103,7 +103,7 @@ public ResponseEntity getCodesListWithoutCodes( public ResponseEntity getCodesListPage( @PathVariable(Constants.NOTATION) String notation, @RequestParam(name = "pageNumber") int pageNumber - ) throws RmesException, JsonProcessingException { + ) throws RmesException, JacksonException { if(pageNumber > codeListsServices.getMaxpage(notation)){ return ResponseEntity.status(HttpStatus.SC_REQUESTED_RANGE_NOT_SATISFIABLE).body(ERROR_PAGINATION); } diff --git a/src/main/java/fr/insee/rmes/controller/DataSetResources.java b/src/main/java/fr/insee/rmes/controller/DataSetResources.java index 19c71824..90dc2550 100644 --- a/src/main/java/fr/insee/rmes/controller/DataSetResources.java +++ b/src/main/java/fr/insee/rmes/controller/DataSetResources.java @@ -1,6 +1,6 @@ package fr.insee.rmes.controller; -import com.fasterxml.jackson.core.JsonProcessingException; +import tools.jackson.core.JacksonException; import fr.insee.security.UserDecoder; import fr.insee.rmes.dto.datasets.PatchDatasetDTO; import fr.insee.rmes.model.datasets.Distributions; @@ -51,7 +51,7 @@ public class DataSetResources { @GetMapping(path = "/datasets/list", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(operationId = "getListDatasets", summary = "Get list of datasets", security = @SecurityRequirement(name = "bearerScheme"), responses = {@ApiResponse(content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(type = "array", implementation = DataSetModelSwagger.class)))}) - public ResponseEntity getListDatasets(@RequestParam(required = false) @Parameter(description = "Date of last update. Example: 2023-01-31") String dateMiseAJour) throws RmesException, JsonProcessingException { + public ResponseEntity getListDatasets(@RequestParam(required = false) @Parameter(description = "Date of last update. Example: 2023-01-31") String dateMiseAJour) throws RmesException, JacksonException { if (dateMiseAJour == null){ dateMiseAJour = ""; } @@ -69,7 +69,7 @@ public ResponseEntity getListDatasets(@RequestParam(required = false) @P public ResponseEntity getDataSetByID(@PathVariable("id") String id, @RequestParam(name = "dateMiseAJour", defaultValue = "false") boolean boolDateMiseAJour - ) throws RmesException, JsonProcessingException { + ) throws RmesException, JacksonException { // par défaut ce booléen est faux et donc on renvoie tout les infos d'un dataset if (!boolDateMiseAJour) { @@ -95,7 +95,7 @@ public ResponseEntity getDataSetByID(@PathVariable("id") String id, @GetMapping(path = "/dataset/{id}/distributions", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity getDataSetDistributionsById(@PathVariable String id) throws RmesException, JsonProcessingException { + public ResponseEntity getDataSetDistributionsById(@PathVariable String id) throws RmesException, JacksonException { return ResponseEntity.ok(dataSetsServices.getDataSetDistributionsById(id)); } diff --git a/src/main/java/fr/insee/rmes/controller/StructuresResources.java b/src/main/java/fr/insee/rmes/controller/StructuresResources.java index 7eb2d5ad..0d97e087 100644 --- a/src/main/java/fr/insee/rmes/controller/StructuresResources.java +++ b/src/main/java/fr/insee/rmes/controller/StructuresResources.java @@ -1,6 +1,6 @@ package fr.insee.rmes.controller; -import com.fasterxml.jackson.core.JsonProcessingException; +import tools.jackson.core.JacksonException; import fr.insee.rmes.modelSwagger.component.AllComponentModelSwagger; import fr.insee.rmes.modelSwagger.component.ComponentByIdModelSwagger; import fr.insee.rmes.modelSwagger.structure.AllStructureModelSwagger; @@ -55,7 +55,7 @@ public ResponseEntity getAllStructures(@RequestParam(required = false) @Operation(operationId = "getStructure", summary = "Get a structure",security = @SecurityRequirement(name = "bearerScheme"), responses = { @ApiResponse(content = @Content(mediaType = "application/json", schema = @Schema(type = "array", implementation = StructureByIdModelSwagger.class)))}) public ResponseEntity getStructure(@PathVariable(Constants.ID) String id, @RequestParam(name = "dateMiseAJour", defaultValue = "false") Boolean boolDateMiseAJour - ) throws RmesException, JsonProcessingException { + ) throws RmesException, JacksonException { // par défaut ce booléen est faux et donc on renvoie tout les infos d'un dataset if (!boolDateMiseAJour){ @@ -125,7 +125,7 @@ public ResponseEntity getComponentById( @Operation(operationId = "getSlice", summary = "Get slice keys",security = @SecurityRequirement(name = "bearerScheme"), responses = { @ApiResponse(content = @Content(mediaType = "application/json", schema = @Schema(type = "array",implementation = StructureSliceKeysModelSwagger.class)))}) - public ResponseEntity getSlice(@PathVariable(Constants.ID) String id) throws RmesException, JsonProcessingException { + public ResponseEntity getSlice(@PathVariable(Constants.ID) String id) throws RmesException, JacksonException { String jsonResult = structuresServices.getSlice(id); if(jsonResult.isEmpty()){ return ResponseEntity.status(HttpStatus.SC_NOT_FOUND).build(); diff --git a/src/main/java/fr/insee/rmes/services/datasets/DataSetsImpl.java b/src/main/java/fr/insee/rmes/services/datasets/DataSetsImpl.java index 14e3a524..67d0d346 100644 --- a/src/main/java/fr/insee/rmes/services/datasets/DataSetsImpl.java +++ b/src/main/java/fr/insee/rmes/services/datasets/DataSetsImpl.java @@ -1,8 +1,9 @@ package fr.insee.rmes.services.datasets; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.ObjectMapper; +import tools.jackson.databind.json.JsonMapper; import fr.insee.rmes.dto.datasets.PatchDatasetDTO; import fr.insee.rmes.model.CodeList.Code; import fr.insee.rmes.model.datasets.*; @@ -37,7 +38,7 @@ public class DataSetsImpl extends RdfService implements DataSetsServices { public static final String DATASET_LIST ="getListDatasets/"; private final Map params = initParams(); - private final ObjectMapper objectMapper = new ObjectMapper(); + ObjectMapper objectMapper = JsonMapper.builder().build(); private final RestClient restClient; private final CodeListsServices codeListsServices; @@ -67,7 +68,7 @@ private List getStatisticalUnit(List uriStatistical,String id } @Override - public String getListDataSets(String dateMiseAJour) throws RmesException, JsonProcessingException { + public String getListDataSets(String dateMiseAJour) throws RmesException, JacksonException { JSONArray listDataSet; if (dateMiseAJour.isEmpty()){ listDataSet = repoGestion.getResponseAsArray(buildRequest(Constants.DATASETS_QUERIES_PATH+DATASET_LIST,"getListDatasets.ftlh", params)); @@ -94,7 +95,7 @@ public String getListDataSets(String dateMiseAJour) throws RmesException, JsonPr @Override - public String getDataSetByID (String id) throws RmesException, JsonProcessingException { + public String getDataSetByID (String id) throws RmesException, JacksonException { JsonNode dataSetFinalNode = emptyDataSetModelSwagger(findDataSetModelSwagger(id)); return dataSetFinalNode.toString(); } @@ -105,7 +106,7 @@ private JsonNode emptyDataSetModelSwagger(DataSetModelSwagger dataSetModelSwagge while (it.hasNext()) { JsonNode node = it.next(); - if (node.isContainerNode() && node.isEmpty()) { + if ((node.isArray() || node.isObject()) && node.isEmpty()) { it.remove(); } } @@ -133,7 +134,7 @@ protected ResponseEntity httpPatchRequest(String token, PatchDatasetDTO return ResponseEntity.status(response.getStatusCode()).build(); } - protected DataSetModelSwagger findDataSetModelSwagger(String id) throws RmesException, JsonProcessingException { + protected DataSetModelSwagger findDataSetModelSwagger(String id) throws RmesException, JacksonException { //paramétrage de la requête params.put("ID", id); JSONObject catalogue_result = repoGestion.getResponseAsObject(buildRequest(Constants.DATASETS_QUERIES_PATH +DATASET_BY_ID_PATH, "getDataSetById_catalogue.ftlh", params)); @@ -183,7 +184,7 @@ private void removeEmptyKeys(JSONObject jsonObject) { } } - protected void testPresenceVariablePuisAjout(DataSetModelSwagger reponse, JSONObject catalogue_result, JSONObject adms_result, JSONObject codes_result, JSONObject organisations_result, JSONObject structures_result) throws RmesException, JsonProcessingException { + protected void testPresenceVariablePuisAjout(DataSetModelSwagger reponse, JSONObject catalogue_result, JSONObject adms_result, JSONObject codes_result, JSONObject organisations_result, JSONObject structures_result) throws RmesException, JacksonException { //récupération de le date de mofidication if (catalogue_result.has("dateModification")) { Modified modified = new Modified(catalogue_result.getString("dateModification")); @@ -402,7 +403,7 @@ protected void testPresenceVariablePuisAjout(DataSetModelSwagger reponse, JSONOb } @Override - public String getDataSetByIDSummary(String id) throws RmesException, JsonProcessingException { + public String getDataSetByIDSummary(String id) throws RmesException, JacksonException { //parametrage de la requête params.put("ID", id); @@ -425,7 +426,7 @@ public String getDataSetByIDSummary(String id) throws RmesException, JsonProcess } @Override - public Distributions[] getDataSetDistributionsById(String id) throws RmesException, JsonProcessingException { + public Distributions[] getDataSetDistributionsById(String id) throws RmesException, JacksonException { //parametrage de la requête params.put("ID", id); @@ -593,7 +594,7 @@ private List getSpatialResolution(List urisSpatialResolution) t return spatialResolution; } - private List getThemeModelSwaggerS(JSONObject dataSetId) throws RmesException, JsonProcessingException { + private List getThemeModelSwaggerS(JSONObject dataSetId) throws RmesException, JacksonException { String[] parts = dataSetId.getString("names").split(","); List themeListModelSwaggerS = new ArrayList<>(); diff --git a/src/main/java/fr/insee/rmes/services/datasets/DataSetsServices.java b/src/main/java/fr/insee/rmes/services/datasets/DataSetsServices.java index c8a5b5aa..ee6e5ff5 100644 --- a/src/main/java/fr/insee/rmes/services/datasets/DataSetsServices.java +++ b/src/main/java/fr/insee/rmes/services/datasets/DataSetsServices.java @@ -6,6 +6,7 @@ import fr.insee.security.User; import fr.insee.rmes.utils.exceptions.RmesException; import org.springframework.http.ResponseEntity; +import tools.jackson.core.JacksonException; import java.net.MalformedURLException; import java.util.Optional; @@ -13,13 +14,13 @@ public interface DataSetsServices { - String getListDataSets(String dateMiseAJour) throws RmesException, JsonProcessingException; + String getListDataSets(String dateMiseAJour) throws RmesException, JacksonException; - String getDataSetByID(String id) throws RmesException, JsonProcessingException; + String getDataSetByID(String id) throws RmesException, JacksonException; - String getDataSetByIDSummary(String id) throws RmesException, JsonProcessingException; + String getDataSetByIDSummary(String id) throws RmesException, JacksonException; - Distributions[] getDataSetDistributionsById(String id) throws RmesException, JsonProcessingException; + Distributions[] getDataSetDistributionsById(String id) throws RmesException, JacksonException; ResponseEntity patchDataset(String datasetId, PatchDatasetDTO patchDataset, String token, Optional user) throws RmesException, MalformedURLException; } diff --git a/src/main/java/fr/insee/rmes/services/structures/StructuresImpl.java b/src/main/java/fr/insee/rmes/services/structures/StructuresImpl.java index 4402e32f..3985c136 100644 --- a/src/main/java/fr/insee/rmes/services/structures/StructuresImpl.java +++ b/src/main/java/fr/insee/rmes/services/structures/StructuresImpl.java @@ -1,7 +1,5 @@ package fr.insee.rmes.services.structures; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; import fr.insee.rmes.modelSwagger.structure.StructureByIdModelSwagger; import fr.insee.rmes.persistence.FreeMarkerUtils; import fr.insee.rmes.persistence.RdfService; @@ -17,6 +15,9 @@ import org.json.JSONObject; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.ObjectMapper; +import tools.jackson.databind.json.JsonMapper; import java.util.HashMap; import java.util.Iterator; @@ -84,7 +85,7 @@ public String getAllStructures(String dateMiseAJour) throws RmesException { } @Override - public String getStructure(String id) throws RmesException, JsonProcessingException { + public String getStructure(String id) throws RmesException, JacksonException { HashMap params = new HashMap<>(); params.put(STRUCTURES_GRAPH, config.getBaseGraph() + config.getStructuresGraph()); params.put(STRUCTURE_ID, id); @@ -141,7 +142,7 @@ public String getStructure(String id) throws RmesException, JsonProcessingExcept getStructureComponents(id, structure); - ObjectMapper mapper = new ObjectMapper(); + ObjectMapper mapper = JsonMapper.builder().build(); StructureByIdModelSwagger structureByID = mapper.readValue(structure.toString(), StructureByIdModelSwagger.class); return mapper.writeValueAsString(structureByID); @@ -153,7 +154,7 @@ public String getStructure(String id) throws RmesException, JsonProcessingExcept @Override - public String getStructureDateMAJ(String id) throws RmesException, JsonProcessingException { + public String getStructureDateMAJ(String id) throws RmesException, JacksonException { HashMap params = new HashMap<>(); params.put(STRUCTURES_GRAPH, config.getBaseGraph() + config.getStructuresGraph()); params.put(STRUCTURE_ID, id); diff --git a/src/main/java/fr/insee/rmes/services/structures/StructuresServices.java b/src/main/java/fr/insee/rmes/services/structures/StructuresServices.java index b19da45e..09a2af80 100644 --- a/src/main/java/fr/insee/rmes/services/structures/StructuresServices.java +++ b/src/main/java/fr/insee/rmes/services/structures/StructuresServices.java @@ -4,7 +4,7 @@ import fr.insee.rmes.utils.exceptions.RmesException; import org.json.JSONObject; import org.springframework.stereotype.Service; - +import tools.jackson.core.JacksonException; @Service @@ -12,14 +12,14 @@ public interface StructuresServices { String getAllStructures(String dateMiseAJour) throws RmesException; - String getStructure(String id) throws RmesException, JsonProcessingException; + String getStructure(String id) throws RmesException, JacksonException; String getAllComponents(String dateMiseAJour) throws RmesException; JSONObject getComponent(String id) throws RmesException; - String getStructureDateMAJ(String id) throws RmesException, JsonProcessingException; + String getStructureDateMAJ(String id) throws RmesException, JacksonException ; JSONObject getComponentDateMAJ(String id) throws RmesException; String getSlice(String id) throws RmesException; From 36fd5cb94de56e2dc9ed5f2506b006f1be904600 Mon Sep 17 00:00:00 2001 From: GtanSndil Date: Tue, 26 May 2026 17:39:37 +0200 Subject: [PATCH 5/6] pom: chore dependencies --- pom.xml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 1df2f7e7..73a2296d 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ jar fr.insee.rmes magma - 1.4.19 + 1.4.20-rc0 magma Metadata management API @@ -28,16 +28,12 @@ inseefr https://sonarcloud.io InseeFr_Magma + + 11.0.22 + - - - - - - - org.springframework.boot spring-boot-starter-webmvc From 3d41bb4dc6f750a088d2c52d39496813673362f2 Mon Sep 17 00:00:00 2001 From: GtanSndil Date: Tue, 26 May 2026 17:41:10 +0200 Subject: [PATCH 6/6] refactor: remove unused imports --- .../java/fr/insee/rmes/services/datasets/DataSetsServices.java | 3 +-- .../fr/insee/rmes/services/structures/StructuresServices.java | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/fr/insee/rmes/services/datasets/DataSetsServices.java b/src/main/java/fr/insee/rmes/services/datasets/DataSetsServices.java index ee6e5ff5..73620a61 100644 --- a/src/main/java/fr/insee/rmes/services/datasets/DataSetsServices.java +++ b/src/main/java/fr/insee/rmes/services/datasets/DataSetsServices.java @@ -1,10 +1,9 @@ package fr.insee.rmes.services.datasets; -import com.fasterxml.jackson.core.JsonProcessingException; import fr.insee.rmes.dto.datasets.PatchDatasetDTO; import fr.insee.rmes.model.datasets.Distributions; -import fr.insee.security.User; import fr.insee.rmes.utils.exceptions.RmesException; +import fr.insee.security.User; import org.springframework.http.ResponseEntity; import tools.jackson.core.JacksonException; diff --git a/src/main/java/fr/insee/rmes/services/structures/StructuresServices.java b/src/main/java/fr/insee/rmes/services/structures/StructuresServices.java index 09a2af80..1cf97d05 100644 --- a/src/main/java/fr/insee/rmes/services/structures/StructuresServices.java +++ b/src/main/java/fr/insee/rmes/services/structures/StructuresServices.java @@ -1,6 +1,5 @@ package fr.insee.rmes.services.structures; -import com.fasterxml.jackson.core.JsonProcessingException; import fr.insee.rmes.utils.exceptions.RmesException; import org.json.JSONObject; import org.springframework.stereotype.Service;