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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

JIRA jira@apache.org
Justin Edelson created SLING-6965:
-------------------------------------

             Summary: 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)
Loading...