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 2017/06/19 14:47:00 UTC

[jira] [Resolved] (SLING-6965) Sling Models Jackson Exporter Fails with default resource serialization for a resource with a child

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

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

fixed in r1799218 with updated IT

> Sling Models Jackson Exporter Fails with default resource serialization for a resource with a child
> ---------------------------------------------------------------------------------------------------
>
>                 Key: SLING-6965
>                 URL: https://issues.apache.org/jira/browse/SLING-6965
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: Sling Models Jackson Exporter 1.0.6
>            Reporter: Justin Edelson
>            Assignee: Justin Edelson
>             Fix For: Sling Models Jackson Exporter 1.0.8
>
>
> If a model class has a serialized Resource field/getter and that Resource has children, the serialization will fail with a stack trace like
> {code}
> Caused by: com.fasterxml.jackson.core.JsonGenerationException: Can not start an object, expecting field name (context: Object)
>     at com.fasterxml.jackson.core.JsonGenerator._reportError(JsonGenerator.java:1897)
>     at com.fasterxml.jackson.core.json.JsonGeneratorImpl._reportCantWriteValueExpectName(JsonGeneratorImpl.java:244)
>     at com.fasterxml.jackson.core.json.WriterBasedJsonGenerator._verifyValueWrite(WriterBasedJsonGenerator.java:815)
>     at com.fasterxml.jackson.core.json.WriterBasedJsonGenerator.writeStartObject(WriterBasedJsonGenerator.java:268)
>     at org.apache.sling.models.jacksonexporter.impl.ResourceSerializer.create(ResourceSerializer.java:52)
>     at org.apache.sling.models.jacksonexporter.impl.ResourceSerializer.create(ResourceSerializer.java:100)
>     at org.apache.sling.models.jacksonexporter.impl.ResourceSerializer.serialize(ResourceSerializer.java:46)
>     at org.apache.sling.models.jacksonexporter.impl.ResourceSerializer.serialize(ResourceSerializer.java:35)
>     at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:292)
>     at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:2493)
>     at org.apache.sling.models.jacksonexporter.impl.JacksonExporter.export(JacksonExporter.java:117)
> {code}
> This is because the object is started twice.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)