diff --git a/src/at/bitfire/davdroid/resource/LocalCalendar.java b/src/at/bitfire/davdroid/resource/LocalCalendar.java index aff732c6..16111979 100644 --- a/src/at/bitfire/davdroid/resource/LocalCalendar.java +++ b/src/at/bitfire/davdroid/resource/LocalCalendar.java @@ -209,37 +209,38 @@ public class LocalCalendar extends LocalCollection { // recurrence try { String duration = cursor.getString(18); - if (duration != null) + if (duration != null && !duration.isEmpty()) e.setDuration(new Duration(new Dur(duration))); String strRRule = cursor.getString(10); - if (strRRule != null) + if (strRRule != null && !strRRule.isEmpty()) e.setRrule(new RRule(strRRule)); String strRDate = cursor.getString(11); - if (strRDate != null) { + if (strRDate != null && !strRDate.isEmpty()) { RDate rDate = new RDate(); rDate.setValue(strRDate); e.setRdate(rDate); } String strExRule = cursor.getString(12); - if (strExRule != null) { + if (strExRule != null && !strExRule.isEmpty()) { ExRule exRule = new ExRule(); exRule.setValue(strExRule); e.setExrule(exRule); } String strExDate = cursor.getString(13); - if (strExDate != null) { + if (strExDate != null && !strExDate.isEmpty()) { // ignored, see https://code.google.com/p/android/issues/detail?id=21426 ExDate exDate = new ExDate(); exDate.setValue(strExDate); e.setExdate(exDate); } - } catch (ParseException ex) { - Log.e(TAG, "Couldn't parse recurrence rules, ignoring"); + Log.w(TAG, "Couldn't parse recurrence rules, ignoring", ex); + } catch (IllegalArgumentException ex) { + Log.w(TAG, "Invalid recurrence rules, ignoring", ex); } // status diff --git a/src/at/bitfire/davdroid/webdav/HttpReport.java b/src/at/bitfire/davdroid/webdav/HttpReport.java index 24661780..bc1bb8f3 100644 --- a/src/at/bitfire/davdroid/webdav/HttpReport.java +++ b/src/at/bitfire/davdroid/webdav/HttpReport.java @@ -23,7 +23,8 @@ public class HttpReport extends HttpEntityEnclosingRequestBase { setURI(uri); setHeader("Content-Type", "text/xml; charset=UTF-8"); - + setHeader("Depth", "0"); + try { setEntity(new StringEntity(entity, "UTF-8")); diff --git a/src/at/bitfire/davdroid/webdav/WebDavResource.java b/src/at/bitfire/davdroid/webdav/WebDavResource.java index 470d74dd..9e323db9 100644 --- a/src/at/bitfire/davdroid/webdav/WebDavResource.java +++ b/src/at/bitfire/davdroid/webdav/WebDavResource.java @@ -437,9 +437,7 @@ public class WebDavResource { if (prop.addressbookDescription != null) properties.put(Property.DESCRIPTION, prop.addressbookDescription.getDescription()); - } else - properties.remove(Property.IS_ADDRESSBOOK); - + } if (prop.resourcetype.getCalendar() != null) { properties.put(Property.IS_CALENDAR, "1"); @@ -457,19 +455,18 @@ public class WebDavResource { for (DavPropComp component : prop.supportedCalendarComponentSet.components) referenced.supportedComponents.add(component.getName()); } - } else - referenced.properties.remove(Property.IS_CALENDAR); + } } if (prop.getctag != null) - referenced.properties.put(Property.CTAG, prop.getctag.getCTag()); + properties.put(Property.CTAG, prop.getctag.getCTag()); if (prop.getetag != null) - referenced.properties.put(Property.ETAG, prop.getetag.getETag()); + properties.put(Property.ETAG, prop.getetag.getETag()); - if (prop.calendarData != null) + if (prop.calendarData != null && prop.calendarData.ical != null) referenced.content = new ByteArrayInputStream(prop.calendarData.ical.getBytes()); - else if (prop.addressData != null) + else if (prop.addressData != null && prop.addressData.vcard != null) referenced.content = new ByteArrayInputStream(prop.addressData.vcard.getBytes()); } }