无法通过Java中的事件ID获取Google日历事件异常

时间:2012-01-19 14:55:43

标签: java google-calendar-api gdata-java-client

我一直在使用Gdata API for Java(v2),并且已经找到了如何通过id获取事件。但是,我无法获取重复事件的异常。

对于常规活动,我会这样取得:

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

并且被查询的网址看起来像这样:

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

它没有任何问题!

轻松自负。

但是,当我尝试使用相同的方法获取对重复事件的异常事件时,我遇到了问题。重复事件的网址是

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

相同的网址,附加了_20120112。问题的本质:

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)

任何人都有任何想法为什么会发生这种情况或更好的方法来解决这个问题?

1 个答案:

答案 0 :(得分:0)

经过大量的测试和开发,我得出结论,你可以像获取正常事件一样获取重复事件的异常,但有一点需要注意:它们无法取消。

男人头疼:-P