You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Justin Edelson (JIRA)" <ji...@apache.org> on 2016/11/17 02:09:58 UTC

[jira] [Resolved] (SLING-6295) StackOverflowException when Jackson tries to serialize a Resource object

     [ https://issues.apache.org/jira/browse/SLING-6295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Justin Edelson resolved SLING-6295.
-----------------------------------
    Resolution: Fixed

Fixed in r1770102.

The actual code used for JSON output could not be reused from Sling Commons JSON but was adapted for use with the Jackson API.

> StackOverflowException when Jackson tries to serialize a Resource object
> ------------------------------------------------------------------------
>
>                 Key: SLING-6295
>                 URL: https://issues.apache.org/jira/browse/SLING-6295
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: Sling Models Jackson Exporter 1.0.0
>            Reporter: Justin Edelson
>            Assignee: Justin Edelson
>            Priority: Critical
>             Fix For: Sling Models Jackson Exporter 1.0.2
>
>
> When a model class has a property of type Resource (or a collection of Resource objects), attempting to serialize that class into a String produces a StackOverflow due to the getParent() method.
> The simplest solution would be to use Jackson mixins to skip the getParent() (and, for good measure, the getResourceResolver() and getResourceMetadata()) methods. A better solution would be to simply use the standard Sling JSON in these cases.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)