From 3e6b9bf77cc5a0d5f8a799788e1922dbb1218f4e Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sun, 2 Jun 2024 13:10:18 +0200 Subject: [PATCH] [FIX] Correct RESTApi.gets retreive data list in a correct way --- src/org/kar/archidata/tools/RESTApi.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/org/kar/archidata/tools/RESTApi.java b/src/org/kar/archidata/tools/RESTApi.java index 11d4e25..b8b3401 100644 --- a/src/org/kar/archidata/tools/RESTApi.java +++ b/src/org/kar/archidata/tools/RESTApi.java @@ -16,7 +16,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.exc.MismatchedInputException; @@ -56,7 +55,9 @@ public class RESTApi { "Fail to get the data [" + httpResponse.statusCode() + "] " + httpResponse.body()); } } - return this.mapper.readValue(httpResponse.body(), new TypeReference>() {}); + //return this.mapper.readValue(httpResponse.body(), new TypeReference>() {}); + return this.mapper.readValue(httpResponse.body(), + this.mapper.getTypeFactory().constructCollectionType(List.class, clazz)); } public T get(final Class clazz, final String urlOffset)