[Cosmo-dev] Caldav4j patch

Roberto Polli rpolli at babel.it
Wed Aug 29 09:09:43 PDT 2007


Alle mercoledì 29 agosto 2007, Brian Moseley ha scritto:
> sure thing. patches are always welcome.
forewords:
1) fixed typo: 
	- udpateMasterEvent
	+updateMasterEvent

2) bedework don't replies always with ETag, so we should check 
getResponseHeader("ETag") != null

-        String newEtag = putMethod.getResponseHeader("ETag").getValue();
+        Header h = putMethod.getResponseHeader("ETag");
+        String newEtag = null;
+        if (h != null) {
+               newEtag = h.getValue();
+        }
+

what do you think about it?
tia,
R.

Patches follows



Index: src/test/java/org/osaf/caldav4j/CalDAVCalendarCollectionTest.java
===================================================================
--- src/test/java/org/osaf/caldav4j/CalDAVCalendarCollectionTest.java   
(revision 5502)
+++ src/test/java/org/osaf/caldav4j/CalDAVCalendarCollectionTest.java   
(working copy)
@@ -210,7 +210,7 @@

                ICalendarUtils.addOrReplaceProperty(ve, new Summary("NEW"));

-               calendarCollection.udpateMasterEvent(httpClient, ve, null);
+               calendarCollection.updateMasterEvent(httpClient, ve, null);

                calendar = 
calendarCollection.getCalendarForEventUID(httpClient,
                                ICS_NORMAL_PACIFIC_1PM_UID);
Index: 
src/test/java/org/osaf/caldav4j/CalDAVCalendarCollectionWithCacheTest.java
===================================================================
--- src/test/java/org/osaf/caldav4j/CalDAVCalendarCollectionWithCacheTest.java  
(revision 5502)
+++ src/test/java/org/osaf/caldav4j/CalDAVCalendarCollectionWithCacheTest.java  
(working copy)
@@ -297,7 +297,7 @@

         ICalendarUtils.addOrReplaceProperty(ve, new Summary("NEW"));

-        calendarCollection.udpateMasterEvent(httpClient, ve, null);
+        calendarCollection.updateMasterEvent(httpClient, ve, null);

         calendar = calendarCollection.getCalendarForEventUID(httpClient,
                 ICS_NORMAL_PACIFIC_1PM_UID);






Index: src/main/java/org/osaf/caldav4j/CalDAVCalendarCollection.java
===================================================================
--- src/main/java/org/osaf/caldav4j/CalDAVCalendarCollection.java       
(revision 5502)
+++ src/main/java/org/osaf/caldav4j/CalDAVCalendarCollection.java       
(working copy)
@@ -37,6 +37,7 @@
 import net.fortuna.ical4j.model.property.ProdId;
 import net.fortuna.ical4j.model.property.Version;

+import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HostConfiguration;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpException;
@@ -360,7 +361,7 @@
      *                 otherwise null
      * @throws CalDAV4JException
      */
-    public void udpateMasterEvent(HttpClient httpClient, VEvent vevent, 
VTimeZone timezone)
+    public void updateMasterEvent(HttpClient httpClient, VEvent vevent, 
VTimeZone timezone)
         throws CalDAV4JException{
         String uid = getUIDValue(vevent);
         CalDAVResource resource = getCalDAVResourceForEventUID(httpClient, 
uid);
@@ -754,7 +755,12 @@
             throw new CalDAV4JException("Problem executing put method",e);
         }

-        String newEtag = putMethod.getResponseHeader("ETag").getValue();
+        Header h = putMethod.getResponseHeader("ETag");
+        String newEtag = null;
+        if (h != null) {
+               newEtag = h.getValue();
+        }
+

         cache.putResource(new CalDAVResource(calendar, newEtag, 
getHref(path)));
     }
@@ -790,7 +796,11 @@
             throw new CalDAV4JException("Problem executing get method",e);
         }

-        String etag = headMethod.getResponseHeader("ETag").getValue();
+        Header h = headMethod.getResponseHeader("ETag");
+        String etag = null;
+        if (h != null) {
+         etag = h.getValue();
+        }
         return etag;
     }


-- 

Roberto Polli
Babel S.r.l. - http://www.babel.it
Tel. +39.06.91801075 - fax +39.06.91612446
P.zza S.Benedetto da Norcia, 33 - 00040 Pomezia (Roma)

"Il seguente messaggio contiene informazioni riservate. Qualora questo 
messaggio fosse da Voi ricevuto per errore, Vogliate cortesemente darcene 
notizia a mezzo e-mail. Vi sollecitiamo altresì a distruggere il messaggio 
erroneamente ricevuto. Quanto precede Vi viene chiesto ai fini del rispetto 
della legge in materia di protezione dei dati personali."


More information about the cosmo-dev mailing list