geremyk / google-gdata

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

AlternateUri returns null pointer exception when used on CalendarEntry instances #237

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Fetch http://www.google.com/calendar/feeds/default/owncalendars/full
2. For one of the CalendarEntry instances that's returned, attempt to
access it's AlternateUri property.

(See attached sample code.)

What is the expected output? What do you see instead?
The Calendar's event feed URL should be returned. Instead, a null pointer
exception results.

Please provide any additional information below.
The problem here seems to be that AlternateUri expects to see an link with
rel="alternate" and type="text/html".

As a workaround, users can use the following instead:

calendarEntry.Links.FindService("alternate", "application/atom+xml")

Original issue reported on code.google.com by tjohns.ggl.legacy@gmail.com on 16 Apr 2009 at 10:49

Attachments:

GoogleCodeExporter commented 8 years ago
Trevor, 

you are getting a null pointer exception because you are accessing 
AlternateUri.Content. And if alternate URI is 
null, that crashes. 

The defintion of alternateUri property states that it is using alternate & 
text/html. If you want something else you 
use the above method. It is a shortcut to access alternate & text/html, not a 
shortcut to access the first random 
alternate. 

Original comment by fman...@gmail.com on 20 Apr 2009 at 12:44