yhknight / odata4j

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

Unable to read ODATA response using odata4j-0.4 #142

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. When using the ODATA response from SAP Gateway server
2. Unable to read the response as the response format is not in line with the 
way the code is looking for.
3.

What is the expected output? What do you see instead?
Expected: We need to get the entities from the response.
Actual: Instead this is showing null pointer exception in class 
org.odata4j.format.xml.AtomFeedFormatParser
at he code line "if (contentType != null && 
contentType.equals(MediaType.APPLICATION_XML))"

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

odata4j-clientbundle-0.4.jar

Please provide any additional information below.
Attached is the response which we are expected to read using the odata4j API.

Below is the error stack:
java.lang.RuntimeException: java.lang.NullPointerException
    at org.core4j.ReadOnlyIterator.hasNext(ReadOnlyIterator.java:49)
    at org.core4j.Enumerable$FuncIterator.hasNext(Enumerable.java:487)
    at org.core4j.Enumerable$FuncIterator.hasNext(Enumerable.java:487)
    at org.core4j.Enumerable.count(Enumerable.java:89)
    at com.ibm.bh.gateway.internal.odata.testOdataXml.main(testOdataXml.java:224)
Caused by: java.lang.NullPointerException
    at org.odata4j.format.xml.AtomFeedFormatParser.parseEntry(AtomFeedFormatParser.java:328)
    at org.odata4j.format.xml.AtomFeedFormatParser.parseFeed(AtomFeedFormatParser.java:159)
    at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:147)
    at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:36)
    at org.odata4j.consumer.OQueryRequestImpl$EntryIterator.advance(OQueryRequestImpl.java:192)
    at org.core4j.ReadOnlyIterator.hasNext(ReadOnlyIterator.java:47)
    ... 4 more

Original issue reported on code.google.com by gir...@gmail.com on 6 Mar 2012 at 3:55

Attachments:

GoogleCodeExporter commented 9 years ago
I had a similar problem with SAP NetWeaver Gateway if the "type" attribute is 
not defined for the feed entry's <atom:content> child element. Fixed it by 
adding the mentioned null pointer check to AtomFeedFormatParser.

Original comment by manuel.r...@gmail.com on 7 Mar 2012 at 12:08

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by john.spurlock on 7 Mar 2012 at 11:49

GoogleCodeExporter commented 9 years ago
This issue was closed by revision c376a1557205.

Original comment by john.spurlock on 8 Mar 2012 at 12:01

GoogleCodeExporter commented 9 years ago
Thanks for reporting, this fix will be including in the soon-to-be-released 0.6

Original comment by john.spurlock on 8 Mar 2012 at 12:01