From 8118177c6d3783891e8511d4922cb89ce1d4d83a Mon Sep 17 00:00:00 2001 From: Fabio Sinibaldi Date: Wed, 1 Dec 2021 12:33:03 +0100 Subject: [PATCH] Fixed Query Request deserialization --- .../application/geoportal/service/utils/Serialization.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/utils/Serialization.java b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/utils/Serialization.java index 676edbe..ef9812f 100644 --- a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/utils/Serialization.java +++ b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/utils/Serialization.java @@ -49,9 +49,9 @@ public class Serialization { Document queryDocument = Document.parse(queryString); log.debug("Document is ",queryDocument.toJson()); QueryRequest req = new QueryRequest(); - if (queryDocument.containsKey("ordering")) + if (queryDocument.getOrDefault("ordering",null)!=null) req.setOrdering(Serialization.read(((Document) queryDocument.get("ordering")).toJson(), QueryRequest.OrderedRequest.class)); - if (queryDocument.containsKey("paging")) + if (queryDocument.getOrDefault("paging",null)!=null) req.setPaging(Serialization.read(((Document) queryDocument.get("paging")).toJson(), QueryRequest.PagedRequest.class)); req.setProjection(queryDocument.get("projection", Document.class)); req.setFilter(queryDocument.get("filter", Document.class));