From 8a3ffa91e3543b51b4c27a7c13162cc473d189e2 Mon Sep 17 00:00:00 2001 From: Mathias Brunkow Moser Date: Mon, 13 May 2024 17:18:46 +0200 Subject: [PATCH] fix(transfer): fixed bug in single api --- .../http/controllers/api/ApiController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dpp-backend/digitalproductpass/src/main/java/org/eclipse/tractusx/digitalproductpass/http/controllers/api/ApiController.java b/dpp-backend/digitalproductpass/src/main/java/org/eclipse/tractusx/digitalproductpass/http/controllers/api/ApiController.java index 33eef55cb..6a53fe28b 100644 --- a/dpp-backend/digitalproductpass/src/main/java/org/eclipse/tractusx/digitalproductpass/http/controllers/api/ApiController.java +++ b/dpp-backend/digitalproductpass/src/main/java/org/eclipse/tractusx/digitalproductpass/http/controllers/api/ApiController.java @@ -26,6 +26,7 @@ package org.eclipse.tractusx.digitalproductpass.http.controllers.api; +import com.fasterxml.jackson.core.type.TypeReference; import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; @@ -197,8 +198,8 @@ public Response singleApi(@Valid @RequestBody SingleApiRequest singleApiRequestB Map searchResponseData; Map contracts; try { - searchResponseData = (Map) jsonUtil.toMap(searchResponse.getData()); - contracts = (Map) jsonUtil.toMap(searchResponseData.get("contracts")); + searchResponseData = jsonUtil.bind(searchResponse.getData(), new TypeReference<>() {}); + contracts = jsonUtil.bind(searchResponseData.get("contracts"), new TypeReference<>() {}); } catch (UtilException e) { response = httpUtil.getInternalError("Failed to search for digital twin in dtrs: " + e.getMessage()); return httpUtil.buildResponse(response, httpResponse);