alwayswill / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

NullPointerException when non-top-level element declares a new namespace and uses it #268

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Version of google-api-java-client (e.g. 1.4.1-beta)?

1.4.1-beta

Java environment (e.g. Java 6, Android 2.3, App Engine 1.4.3)?

JDK 1.6.0

Describe the problem.

NullPointerException when namespace is defined on a non-top-level element

Google Document List Feed produces an interior element
<app:edited 
xmlns:app='http://www.w3.org/2007/app'>2011-08-09T04:38:14.017Z</app:edited>

The xmlns:app definition only occurs on this element, not the top-level 
element.  When this is parsed:

java.lang.NullPointerException
        at com.google.api.client.xml.Xml.getFieldName(Xml.java:513)
        at com.google.api.client.xml.Xml.parseElementInternal(Xml.java:317)
        at com.google.api.client.xml.Xml.parseElementInternal(Xml.java:454)
        at com.google.api.client.xml.Xml.parseElement(Xml.java:198)
        at com.google.api.client.http.xml.XmlHttpParser.parse(XmlHttpParser.java:72)
        at com.google.api.client.http.HttpResponse.parseAs(HttpResponse.java:298)
        at org.springhaven.testing.GdataTest1.main(GdataTest1.java:166)

How would you expect it to be fixed?

Use a namespace stack and duplicate the namespace-addition code in Xml.java 
lines 228-247 at the start of each element (around line 317) to populate the 
stack.

Original issue reported on code.google.com by darkfoxp...@gmail.com on 13 Aug 2011 at 2:31

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/google-http-java-client/issues/detail?id=23

Original comment by yan...@google.com on 16 Aug 2011 at 2:21