From b7bf8fcd5b8b526bde9db48c17573e34703d72c7 Mon Sep 17 00:00:00 2001 From: Volker Schmidt Date: Mon, 29 Jul 2019 19:30:57 +0200 Subject: [PATCH] Fixes issue with serialized polled items (stack overflow). --- .../service/impl/DhisMetadataPolledItemDeserializer.java | 8 +++++++- .../dhis/service/impl/DhisMetadataPolledItems.java | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/dhis/src/main/java/org/dhis2/fhir/adapter/dhis/service/impl/DhisMetadataPolledItemDeserializer.java b/dhis/src/main/java/org/dhis2/fhir/adapter/dhis/service/impl/DhisMetadataPolledItemDeserializer.java index 01126e98..1b90c21f 100644 --- a/dhis/src/main/java/org/dhis2/fhir/adapter/dhis/service/impl/DhisMetadataPolledItemDeserializer.java +++ b/dhis/src/main/java/org/dhis2/fhir/adapter/dhis/service/impl/DhisMetadataPolledItemDeserializer.java @@ -33,6 +33,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import com.fasterxml.jackson.databind.node.ObjectNode; +import org.dhis2.fhir.adapter.dhis.poll.PolledItems; import java.io.IOException; import java.util.Iterator; @@ -72,6 +73,11 @@ public DhisMetadataPolledItems deserialize( JsonParser p, DeserializationContext } } - return p.getCodec().treeToValue( rootNode, DhisMetadataPolledItems.class ); + return new DhisMetadataPolledItems( p.getCodec().treeToValue( rootNode, InternalDhisMetadataPolledItems.class ) ); + } + + public static class InternalDhisMetadataPolledItems extends PolledItems + { + private static final long serialVersionUID = -3139366174834526658L; } } diff --git a/dhis/src/main/java/org/dhis2/fhir/adapter/dhis/service/impl/DhisMetadataPolledItems.java b/dhis/src/main/java/org/dhis2/fhir/adapter/dhis/service/impl/DhisMetadataPolledItems.java index 9b2bbabe..1cde5220 100644 --- a/dhis/src/main/java/org/dhis2/fhir/adapter/dhis/service/impl/DhisMetadataPolledItems.java +++ b/dhis/src/main/java/org/dhis2/fhir/adapter/dhis/service/impl/DhisMetadataPolledItems.java @@ -53,4 +53,10 @@ public DhisMetadataPolledItems( @Nonnull List items ) { setItems( items ); } + + public DhisMetadataPolledItems( @Nonnull PolledItems polledItems ) + { + setItems( polledItems.getItems() ); + setPager( polledItems.getPager() ); + } }