You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Ramesh Reddy (JIRA)" <ji...@apache.org> on 2018/06/25 13:42:00 UTC

[jira] [Commented] (OLINGO-1272) Select without primary key fails with JSON serializer but works fine with XML

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

Ramesh Reddy commented on OLINGO-1272:
--------------------------------------

Whether selected or not, since entity's id is based on the primary key reference, so your implementation must implicitly include it. selection is for return payload purposes, that does not mean you can omit to set the value.

> Select without primary key fails with JSON serializer but works fine with XML
> -----------------------------------------------------------------------------
>
>                 Key: OLINGO-1272
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1272
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-core, odata4-client, odata4-commons, odata4-server
>    Affects Versions: (Java) V4 4.4.0
>            Reporter: Aarzoo Aggarwal
>            Priority: Major
>
> We create an entity with A primary key reference.
> The request - [http://ip:host/odata/entity?$select=key,col1,|http://iphost/]col2
> The same request when tried with select query parameter having columns except the primary key like -
> [http://ip:host/odata/entity?$select=col1,|http://iphost/]col2 - stops working with json format.
> Getting the same result works fine with request header set as - Accept=application/xml
> It gives a null pointer exception with Accept=application/json with following trace -
> java.lang.NullPointerException: null
>  at org.apache.olingo.server.core.uri.UriHelperImpl.findPropertyRefValue(UriHelperImpl.java:125)
>  at org.apache.olingo.server.core.uri.UriHelperImpl.buildKeyPredicate(UriHelperImpl.java:88)
>  at org.apache.olingo.server.core.serializer.json.ODataJsonSerializer.getEntityId(ODataJsonSerializer.java:334)
>  at org.apache.olingo.server.core.serializer.json.ODataJsonSerializer.writeEntity(ODataJsonSerializer.java:399)
>  at org.apache.olingo.server.core.serializer.json.ODataJsonSerializer.writeEntitySet(ODataJsonSerializer.java:312)
>  at org.apache.olingo.server.core.serializer.json.ODataJsonSerializer.entityCollection(ODataJsonSerializer.java:198



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)