Hi Richard,

Since you are getting the The VersionConflictException which implies
that you are trying to update an event which version ID is stale.  Are
you hardcoding the event ID in your code? You should try to retrieve a
fresh event just before you use it for modification to ensure that
version is not stale.

Hope it helps,
Austin

On Oct 26, 11:54 am, "Richard Quintin" <[EMAIL PROTECTED]> wrote:
> Thanks for your response.  I'm using 1.14.1.  setVal was a typo in my
> email.  I actually am using setValue.
>
> To avoid further confusion, here is the actual code.  A call is made
> to setAlertTime() and when alertTime does not exist for the entry, it
> is added.  It is on the call to entry.update() that the failure
> occurs.  Note that the extended property _does_ get added.  It just
> throws VersionConflictException in the process.
>
>        private CalendarEventEntry entry;
>        private ExtendedProperty alertTime = null;
>
>        public void setAlertTime(long timeInMillis) {
>                if (alertTime == null) {
>                        alertTime = addProperty(ALERT_TIME,
> Long.toString(timeInMillis));
>                } else {
>                        alertTime.setValue(Long.toString(timeInMillis));
>                        update();
>                }
>        }
>        private ExtendedProperty addProperty(String name, String initialValue) 
> {
>                ExtendedProperty retVal = new ExtendedProperty();
>                retVal.setName(propName(name));
>                retVal.setValue(initialValue);
>                logger.info("Adding event extended property '" + name +
> "' for '" +
> title + "'");
>                entry.addExtendedProperty(retVal);
>                update();
>                return retVal;
>        }
>        private void update() {
>                try {
>                        entry.update();
>                } catch (IOException e) {
>                        e.printStackTrace();
>                } catch (ServiceException e) {
>                        e.printStackTrace();
>                }
>        }
>
> Again, thanks for your help!
>
> On 10/26/07, Austin (Google) <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
>
> > Hi Richard,
>
> > Which version of the GData Java Client Library are you using? I
> > noticed that you are using "setVal()" instead of "setValue()" which is
> > in the latest 1.14 version of the Java Client Library.  You may
> > download the latest jar from here:
>
> >http://code.google.com/p/gdata-java-client/downloads/list
>
> > Hope it helps,
> > Austin
>
> > On Oct 26, 5:41 am, "Richard Quintin" <[EMAIL PROTECTED]> wrote:
> > > Hi all,
>
> > > I'm playing around with the API trying to create an event notification
> > > application.  (I can't believe this hasn't been written yet! :)
>
> > > Anyway when I execute code to add a property to an event I get a
> > > VersionConflictException.  The documentation on this exception isn't
> > > very revealing (at least to me).  Does anyone have any ideas what I
> > > might be doing wrong?
>
> > > Thanks for any and all help!
>
> > > Here is (essentially) the code I'm executing:
>
> > > private ExtendedProperty alertTime = new ExtendedProperty();
> > > alertTime.setName("GAlert! alert time";
> > > alertTime.setVal(Long.toString(Calendar.getInstance().timeInMillis()));
> > > // entry is an existing CalendarEventEntry
> > > entry.addExtendedProperty(alertTime);
> > > entry.update();
>
> > > Here is a sample exception stack:
> > > com.google.gdata.util.VersionConflictException: Conflict
> > > <?xml version='1.0' encoding='UTF-8'?><entry
> > > xmlns='http://www.w3.org/2005/Atom'
> > > xmlns:batch='http://schemas.google.com/gdata/batch'
> > > xmlns:gCal='http://schemas.google.com/gCal/2005'
> > > xmlns:gd='http://schemas.google.com/g/2005'><id>http://www.google.com/calendar/feeds/richardjq%40gmail.com/private/fu...</id><published>2007-10-26T12:23:53.000Z</published><updated>2007-10-26T­12:­29:53.000Z</updated><category
> > > scheme='http://schemas.google.com/g/2005#kind'
> > > term='http://schemas.google.com/g/2005#event'/><title
> > > type='text'>test</title><content type='text'></content><link
> > > rel='alternate' type='text/html'
> > > href='http://www.google.com/calendar/event?eid=MDVja3ZldGxqYmtvaW0zcWRqaGs3...
> > > title='alternate'/><link rel='self' type='application/atom+xml'
> > > href='http://www.google.com/calendar/feeds/richardjq%40gmail.com/private/fu...><link
> > > rel='edit' type='application/atom+xml'
> > > href='http://www.google.com/calendar/feeds/richardjq%40gmail.com/private/fu...><author><name>Richard
> > > Quintin</name><email>[EMAIL 
> > > PROTECTED]</email></author><gd:comments><gd:feedLink
> > > href='http://www.google.com/calendar/feeds/richardjq%40gmail.com/private/fu...></gd:comments><gd:eventStatus
> > > value='http://schemas.google.com/g/2005#event.confirmed'/><gd:visibility
> > > value='http://schemas.google.com/g/2005#event.default'/><gd:transparency
> > > value='http://schemas.google.com/g/2005#event.opaque'/><gCal:uid
> > > value='[EMAIL PROTECTED]'/><gCal:sequence
> > > value='0'/><gd:when startTime='2007-10-26T14:00:00.000-04:00'
> > > endTime='2007-10-26T15:00:00.000-04:00'/><gd:who
> > > rel='http://schemas.google.com/g/2005#event.organizer'
> > > valueString='Richard Quintin'
> > > email='[EMAIL PROTECTED]'/><gd:where/><gd:extendedProperty
> > > name='GAlert! notified' value='NO'/><gd:extendedProperty name='GAlert!
> > > alert time' value='1193421000000'/></entry>
>
> > >         at 
> > > com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(Unknown
> > > Source)
> > >         at 
> > > com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(Unknown
> > > Source)
> > >         at 
> > > com.google.gdata.client.http.HttpGDataRequest.checkResponse(Unknown 
> > > Source)
> > >         at com.google.gdata.client.http.HttpGDataRequest.execute(Unknown 
> > > Source)
> > >         at 
> > > com.google.gdata.client.http.GoogleGDataRequest.execute(Unknown Source)
> > >         at com.google.gdata.client.Service.update(Unknown Source)
> > >         at com.google.gdata.client.GoogleService.update(Unknown Source)
> > >         at com.google.gdata.data.BaseEntry.update(Unknown Source)
> > >         at edu.vt.dbms.galert.model.GEvent.update(GEvent.java:141)
> > >         at edu.vt.dbms.galert.model.GEvent.setAlertTime(GEvent.java:195)
> > >         at edu.vt.dbms.galert.model.GEvent.getProperties(GEvent.java:70)
> > >         at edu.vt.dbms.galert.model.GEvent.<init>(GEvent.java:47)
> > >         at 
> > > edu.vt.dbms.galert.model.GCalendar.fetchEvents(GCalendar.java:117)
> > >         at 
> > > edu.vt.dbms.galert.model.GCalArrayList.fetchAllEvents(GCalArrayList.java:97­­)
> > >         at edu.vt.dbms.galert.controller.GAlert.getEvents(GAlert.java:116)
> > >         at 
> > > edu.vt.dbms.galert.controller.GAlert.getTodaysEvents(GAlert.java:105)
> > >         at 
> > > edu.vt.dbms.galert.view.DataPanel.refreshCalendars(DataPanel.java:95)
> > >         at 
> > > edu.vt.dbms.galert.view.DataPanel$1.actionPerformed(DataPanel.java:38)
> > >         at javax.swing.Timer.fireActionPerformed(Timer.java:271)
> > >         at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
> > >         at 
> > > java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
> > >         at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
> > >         at 
> > > java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.jav­­a:273)
> > >         at 
> > > java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:1­­83)
> > >         at 
> > > java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.jav­­a:173)
> > >         at 
> > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
> > >         at 
> > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
> > >         at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
> > > --
> > > Richard Quintin, DBA
> > > Database & Application Administration
> > > Virginia Tech
>
> --
> Richard Quintin, DBA
> Database & Application Administration
> Virginia Tech- Hide quoted text -
>
> - Show quoted text -


--~--~---------~--~----~------------~-------~--~----~
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