Trouble fetching Google calendar event exceptions by event id in Java

本秂侑毒 提交于 2019-12-13 21:52:21

问题


I've been working with the Gdata API for Java (v2), and have figured out how to fetch events by their id. However, I'm having trouble fetching exceptions to recurring events.

For a regular event, I would fetch it as such:

CalendarEventEntry event = getCalendarService().getEntry(new URL("https://www.google.com/calendar/feeds/"+googleCalId+"/private/full/"+eventId), CalendarEventEntry.class);

and the url being queried would look something like this:

https://www.google.com/calendar/feeds/772olgd23vedk7cmvmqgcke5jps%40group.calendar.google.com/private/full/6qlnf002ge3kh6fmp3i6skbuk

And it fetches with no issue!

Easy peasy.

However, when I try to fetch an event that is an exception to a recurring event using the same method, I run into problems. The url of the repeating event would be

https://www.google.com/calendar/feeds/772olgd23vedk7cmvmqgcke5jps%40group.calendar.google.com/private/full/6qlnf002ge3kh6fmp3i6skbuk_20120112

Same url, with _20120112 appended. The nature of the problem:

com.google.gdata.util.ResourceNotFoundException: Not Found
<html><head><meta http-equiv="content-type" content="text/html;charset=UTF-8">
<title>Error</title>
<style type="text/css">body {font-family: arial,sans-serif}</style></head>
<body text="#000000" bgcolor="#ffffff"><table border="0" cellpadding="2" cellspacing="0" width="100%"><tr><td rowspan="3" width="1%" nowrap><b><font face="times" size="10"><font color="#0039b6">G</font> <font color="#c41200">o</font> <font color="#f3c518">o</font> <font color="#0039b6">g</font> <font color="#30a72f">l</font> <font color="#c41200">e</font></font>&nbsp;&nbsp;</b></td>
<td>&nbsp;</td></tr>
<tr><td bgcolor="#3366cc"><font face="arial,sans-serif" color="#ffffff"><b>Error</b></font></td></tr>
<tr><td>&nbsp;</td></tr></table>
<blockquote>Cannot access the calendar you requested</blockquote>
<p></p>
<div style="background:#3366cc; width:1px; height:4px"></div></body></html>

        at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:591)
        at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563)
        at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:552)
        at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:530)
        at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535)
        at com.google.gdata.client.Service.getEntry(Service.java:1352)
        at com.google.gdata.client.GoogleService.getEntry(GoogleService.java:567)
        at com.google.gdata.client.Service.getEntry(Service.java:1278)
        at com.testsoftware.google.CalendarServiceManager.getEventById(CalendarServiceManager.java:410)
        ...stack of my program here...
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)

Anybody have any ideas why this is happening or better ways to go about this?


回答1:


Well after much testing and development, I've concluded that you can fetch exceptions to repeating events in the same way one fetches normal events, with one caveat: they can't be canceled.

Man what a headache :-P



来源:https://stackoverflow.com/questions/8928163/trouble-fetching-google-calendar-event-exceptions-by-event-id-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!