amarildopps / odata4j

Automatically exported from code.google.com/p/odata4j
2 stars 0 forks source link

odata4j json parser has bug #273

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.use microsoft odata v2 as example
http://services.odata.org/V2/OData/OData.svc

2. try to get the product and it's category use the following code

ODataConsumers.Builder builder = (Builder) 
ODataConsumers.newBuilder("http://services.odata.org/V2/OData/OData.svc");

ODataConsumer c = builder.setFormatType(FormatType.JSON).build();

Enumerable<OEntity> result = 
c.getEntities("Products").select("ID,Name,Description,ReleaseDate,DiscontinuedDa
te,Rating,Price,Supplier").expand("Supplier").execute();

3.

What is the expected output? What do you see instead?

it's should return values, but what meet exceptions as following:

Exception in thread "main" java.lang.NullPointerException
    at org.odata4j.format.json.JsonFormatParser.getValue(JsonFormatParser.java:352)
    at org.odata4j.format.json.JsonFormatParser.addProperty(JsonFormatParser.java:230)
    at org.odata4j.format.json.JsonFormatParser.parseEntry(JsonFormatParser.java:123)
    at org.odata4j.format.json.JsonFormatParser.getValue(JsonFormatParser.java:352)
    at org.odata4j.format.json.JsonFormatParser.addProperty(JsonFormatParser.java:230)
    at org.odata4j.format.json.JsonFormatParser.parseEntry(JsonFormatParser.java:123)
    at org.odata4j.format.json.JsonFormatParser.parseEntry(JsonFormatParser.java:133)
    at org.odata4j.format.json.JsonFormatParser.parseFeed(JsonFormatParser.java:90)
    at org.odata4j.format.json.JsonFeedFormatParser.parse(JsonFeedFormatParser.java:126)
    at org.odata4j.format.json.JsonFeedFormatParser.parse(JsonFeedFormatParser.java:1)
    at org.odata4j.consumer.ConsumerQueryEntitiesRequest.doRequest(ConsumerQueryEntitiesRequest.java:64)
    at org.odata4j.consumer.ConsumerQueryEntitiesRequest.getEntries(ConsumerQueryEntitiesRequest.java:47)
    at org.odata4j.consumer.ConsumerQueryEntitiesRequest.execute(ConsumerQueryEntitiesRequest.java:37)

What version of the product are you using? On what operating system?

version0.7 on windows7

Please provide any additional information below.

Original issue reported on code.google.com by whu.li.l...@gmail.com on 6 Dec 2013 at 2:10