Skip to content

Commit

Permalink
Fixes issue with serialized polled items (stack overflow).
Browse files Browse the repository at this point in the history
  • Loading branch information
volsch committed Jul 29, 2019
1 parent 9a8e80f commit b7bf8fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<DhisMetadataPolledItem>
{
private static final long serialVersionUID = -3139366174834526658L;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,10 @@ public DhisMetadataPolledItems( @Nonnull List<DhisMetadataPolledItem> items )
{
setItems( items );
}

public DhisMetadataPolledItems( @Nonnull PolledItems<DhisMetadataPolledItem> polledItems )
{
setItems( polledItems.getItems() );
setPager( polledItems.getPager() );
}
}

0 comments on commit b7bf8fc

Please sign in to comment.