You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by Hank Bruning <ha...@jblade.com> on 2015/08/26 20:54:07 UTC

JSONServiceDocumentDeserializer question

I am not sure if there is a bug in the source HTML document or in  the class

org.apache.olingo.client.core.data;.JSONServiceDocumentDeserializer
from Olingo Java 4, beta 3, Line 72  which is
for (final Iterator<JsonNode> itor = tree.get(Constants.VALUE).elements();

The code is throwing a NullPointerException because
tree.get(Constants.VALUE)== null.

The JSON message is
{
    "@Redfish.Copyright": "Copyright © 2014-2015 Distributed Management
Task Force, Inc. (DMTF). All rights reserved.",
    "@odata.context": "/redfish/v1/$metadata#Chassis",
    "@odata.id": "/redfish/v1/Chassis",
    "@odata.type": "#ChassisCollection.ChassisCollection",
    "Name": "Chassis Collection",
    "Members@odata.count": 5,
    "Members": [
        {
            "@odata.id": "/redfish/v1/Chassis/1"
        },
        {
            "@odata.id": "/redfish/v1/Chassis/Enc1"
        },
        {
            "@odata.id": "/redfish/v1/Chassis/Blade1"
        },
        {
            "@odata.id": "/redfish/v1/Chassis/Blade2"
        }
    ],
    "Members@odata.nextLink": "/redfish/v1/Chassis/Page2/$ref"
}

and the tree object contains 7 elements which are

//   "@Redfish.Copyright":"Copyright © 2014-2015 Distributed Management
Task Force, Inc. (DMTF). All rights reserved.",
//   "@odata.id":"/redfish/v1/Chassis",
//   "@odata.type":"#ChassisCollection.ChassisCollection",
//    "Name":"Chassis Collection",
//    "Members@odata.count":5,
//     "Members":[{"@odata.id":"/redfish/v1/Chassis/1"},
//                                               {"@odata.id
":"/redfish/v1/Chassis/Enc1"},
//                                               {"@odata.id
":"/redfish/v1/Chassis/Blade1"},
//                                               {"@odata.id
":"/redfish/v1/Chassis/Blade2"}],
//    "Members@odata.nextLink":"/redfish/v1/Chassis/Page2/$ref"}

Any idea what the problem is ? Where should I look next ?
Hank

RE: JSONServiceDocumentDeserializer question

Posted by "Amend, Christian" <ch...@sap.com>.
Hi Hank,

it seems that you try to deserialize an entity with the service document deserializer. What is happening is that it is looking for the values array which should look something like that: 
"value": [
{
"name": "ESAllPrim",
"url": "ESAllPrim"
}]

I don`t know how you call the deserializer but please make sure that your URL is pointing to the service document. 

Also the best place for questions like this is the user@olingo.apache.org mailing list since this question might also be of interest for other users. The dev mailing list is for development related discussions. If you would like to subscribe to our user list please write a mail to: user-subscribe@olingo.apache.org 

Best Regards,
Christian

-----Original Message-----
From: Hank Bruning [mailto:hank@jblade.com] 
Sent: Mittwoch, 26. August 2015 20:54
To: dev@olingo.apache.org
Subject: JSONServiceDocumentDeserializer question

I am not sure if there is a bug in the source HTML document or in  the class

org.apache.olingo.client.core.data;.JSONServiceDocumentDeserializer
from Olingo Java 4, beta 3, Line 72  which is
for (final Iterator<JsonNode> itor = tree.get(Constants.VALUE).elements();

The code is throwing a NullPointerException because
tree.get(Constants.VALUE)== null.

The JSON message is
{
    "@Redfish.Copyright": "Copyright © 2014-2015 Distributed Management
Task Force, Inc. (DMTF). All rights reserved.",
    "@odata.context": "/redfish/v1/$metadata#Chassis",
    "@odata.id": "/redfish/v1/Chassis",
    "@odata.type": "#ChassisCollection.ChassisCollection",
    "Name": "Chassis Collection",
    "Members@odata.count": 5,
    "Members": [
        {
            "@odata.id": "/redfish/v1/Chassis/1"
        },
        {
            "@odata.id": "/redfish/v1/Chassis/Enc1"
        },
        {
            "@odata.id": "/redfish/v1/Chassis/Blade1"
        },
        {
            "@odata.id": "/redfish/v1/Chassis/Blade2"
        }
    ],
    "Members@odata.nextLink": "/redfish/v1/Chassis/Page2/$ref"
}

and the tree object contains 7 elements which are

//   "@Redfish.Copyright":"Copyright © 2014-2015 Distributed Management
Task Force, Inc. (DMTF). All rights reserved.",
//   "@odata.id":"/redfish/v1/Chassis",
//   "@odata.type":"#ChassisCollection.ChassisCollection",
//    "Name":"Chassis Collection",
//    "Members@odata.count":5,
//     "Members":[{"@odata.id":"/redfish/v1/Chassis/1"},
//                                               {"@odata.id
":"/redfish/v1/Chassis/Enc1"},
//                                               {"@odata.id
":"/redfish/v1/Chassis/Blade1"},
//                                               {"@odata.id
":"/redfish/v1/Chassis/Blade2"}],
//    "Members@odata.nextLink":"/redfish/v1/Chassis/Page2/$ref"}

Any idea what the problem is ? Where should I look next ?
Hank