olingo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frederik Zimmer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OLINGO-1123) Error deserialization of complex collection with derived type
Date Thu, 22 Jun 2017 10:06:00 GMT

    [ https://issues.apache.org/jira/browse/OLINGO-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16059095#comment-16059095
] 

Frederik Zimmer commented on OLINGO-1123:
-----------------------------------------

Hi Archana,

I'm creating a new entity and I'm sending something like this:
{"@odata.type":"#namespace.MyEntity","params@odata.type":"#Collection(namespace.Param)","params":[{"@odata.type":"#namespace.StringParam","value":"1","id@odata.type":"String","id":"stringParam1"}]}

The metadata is:
<EntityType Name="MyEntity">
<Property Name="params" Type="Collection(namespace.Param)"/>
</EntityType>

<ComplexType Name="Param" Abstract="true">
<Property Name="id" Type="Edm.String"/>
</ComplexType>

<ComplexType Name="StringParam" BaseType="namespace.Param">
<Property Name="value" Type="Edm.String"/>
</ComplexType>

Then I get this exception as the value property of the StringParam isn't read as it is deserialized
as a Param:
org.apache.olingo.server.api.deserializer.DeserializerException: Tree should be empty but
still has content left: value
at org.apache.olingo.server.core.deserializer.json.ODataJsonDeserializer.assertJsonNodeIsEmpty(ODataJsonDeserializer.java:836)
at org.apache.olingo.server.core.deserializer.json.ODataJsonDeserializer.readComplexNode(ODataJsonDeserializer.java:542)
at org.apache.olingo.server.core.deserializer.json.ODataJsonDeserializer.consumePropertyCollectionNode(ODataJsonDeserializer.java:573)
at org.apache.olingo.server.core.deserializer.json.ODataJsonDeserializer.consumePropertyNode(ODataJsonDeserializer.java:495)
at org.apache.olingo.server.core.deserializer.json.ODataJsonDeserializer.consumeEntityProperties(ODataJsonDeserializer.java:363)
at org.apache.olingo.server.core.deserializer.json.ODataJsonDeserializer.consumeEntityNode(ODataJsonDeserializer.java:194)
at org.apache.olingo.server.core.deserializer.json.ODataJsonDeserializer.entity(ODataJsonDeserializer.java:180)

Regards,
Frederik

> Error deserialization of complex collection with derived type
> -------------------------------------------------------------
>
>                 Key: OLINGO-1123
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1123
>             Project: Olingo
>          Issue Type: Bug
>    Affects Versions: (Java) V4 4.3.0
>            Reporter: Frederik Zimmer
>
> If a complex collection which contains entries with derived types is deserialized the
entries are deserialized with the collection type. This results then in an error "DeserializerException:
Tree should be empty but still has content left" because the derived type has more properties
which are not read.
> In ODataJsonDeserializer the method consumePropertyCollectionNode should check with the
collection node specifies it's own type and then use this type for deserialization.



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

Mime
View raw message