On Wed, Dec 31, 2008 at 5:32 AM, [email protected]
<[email protected]> wrote:
>
> Hi,
>   When i run the following code, i get an excpetion. Both the code
> and its outpur is shown below
> ========================
> CalendarService service = new CalendarService
> ("[email protected]");
> service.setUserCredentials("[email protected]", "password");
> List<CalendarEventEntry> events=new ArrayList<CalendarEventEntry>();
> int batchId=0;
> URL feedUrl = new URL("http://www.google.com/calendar/feeds/default/
> private/full/");
> CalendarEventFeed feed = service.getFeed(feedUrl,
> CalendarEventFeed.class);
> events.add(feed.getEntries().get(0));
> System.out.println("The size of events is: "+ events.size());
> CalendarEventFeed batchRequest = new CalendarEventFeed();
> for(CalendarEventEntry event:events){
>        System.out.println("At position 0:");
>        batchId++;
>        BatchUtils.setBatchId(event, Integer.toString(batchId));
>        BatchUtils.setBatchOperationType(event, BatchOperationType.UPDATE);
>        batchRequest.getEntries().add(event);
> }
> // Ensure that all the operations were successful.
> System.out.println("At position 4:");
> Link batchLink = feed.getLink(Link.Rel.FEED_BATCH, Link.Type.ATOM);
> System.out.println("The batchLInk is: "+batchLink);
> System.out.println("The batchURL is: "+new URL(batchLink.getHref()));
> System.out.println("At position 5:");
> CalendarEventFeed batchResponse = service.batch(new URL
> (batchLink.getHref()), batchRequest);
> System.out.println("The batchresponse size is : "+
> batchResponse.getEntries().size());
> System.out.println("At position 6:");
> boolean isSuccess = true;
>
> for (CalendarEventEntry entry : batchResponse.getEntries()) {
> System.out.println("At position 6a:");
>        String sBatchId = BatchUtils.getBatchId(entry);
>        if (!BatchUtils.isSuccess(entry)) {
>            isSuccess = false;
>            System.out.println("At position 7:");
>            BatchStatus status = BatchUtils.getBatchStatus(entry);
>        }
> }
>
> if (isSuccess) {
>        System.out.println("Successfully updated all events via batch
> request.");
> }
> ==================
> The size of events is: 1
> At position 0:
> At position 4:
> The batchLInk is: com.google.gdata.data.l...@f593af
> The batchURL is: 
> http://www.google.com/calendar/feeds/default/private/full/batch
> At position 5:
> The batchresponse size is : 1
> At position 6:
> At position 6a:
> The exception is: java.lang.IllegalArgumentException: Not a batch
> response entry; Missing BatchStatus extension.
> ====================
>
> Can some one please tell what might be wrong ???

I'm really not sure what's wrong here. I was able to run your code
fine without any problems:

[Session started at 2009-01-06 17:33:15 -0800.]
The size of events is: 1
At position 0:
At position 4:
The batchLInk is: com.google.gdata.data.l...@d1c3cd
The batchURL is: http://www.google.com/calendar/feeds/default/private/full/batch
At position 5:
The batchresponse size is : 1
At position 6:
At position 6a:
Successfully updated all events via batch request.

Perhaps try downloading a new version of the client library?

-- 
Trevor Johns

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" group.
To post to this group, send email to 
[email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to