2012-01-19 14 views
0

我一直在使用Gdata API for Java(v2),並想出瞭如何通過它們的id獲取事件。但是,我無法將重複事件的異常提取出來。在Java中通過事件ID獲取Google日曆事件異常時遇到麻煩

對於一個普通的事件,我把它拿來作爲這樣的:

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 

相同的URL,附加了_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) 

任何人有任何想法爲什麼會發生這種情況或更好的方式來解決這個問題?

+0

我已經張貼了我的問題在這裏也:http://code.google.com/apis/calendar/community/forum.html?place=topic%2Fgoogle-日曆API%2FbKtEDLPySBc%2Fdiscussion – atraudes

回答

0

經過多次測試和開發,我已經得出結論,您可以使用與獲取正常事件相同的方式來獲取重複事件的異常,但有一點需要注意:它們不能被取消。

男人真是讓人頭疼:-P

相關問題