xsl/ical: add fallback duration of 2 hours for events w/o end

W/System.err(  450): java.lang.IllegalArgumentException: DTEND and DURATION cannot both be null for an event.
W/System.err(  450):    at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:167)
W/System.err(  450):    at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
W/System.err(  450):    at android.content.ContentProviderProxy.insert(ContentProviderNative.java:476)
W/System.err(  450):    at android.content.ContentResolver.insert(ContentResolver.java:1207)
W/System.err(  450):    at jp.classmethod.us.android.icalsync.helper.CalendarHelper.entryUpdateEvent(CalendarHelper.java:349)
W/System.err(  450):    at jp.classmethod.us.android.icalsync.helper.CalendarHelper.entryUpdateEventList(CalendarHelper.java:232)
W/System.err(  450):    at jp.classmethod.us.android.icalsync.sync.SyncAdapter.onPerformSync(SyncAdapter.java:111)
W/System.err(  450):    at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)
E/SyncAdapter(  450): jp.classmethod.us.android.icalsync.exception.SystemException
D/SyncAdapter(  450): Sync end
This commit is contained in:
Astro 2015-08-04 00:11:39 +02:00
parent a346002d03
commit 1d5be41f70
1 changed files with 22 additions and 16 deletions

View File

@ -88,22 +88,28 @@
</xsl:template>
<xsl:template match="end">
<xsl:if test="not(string(.) = string(../start))">
<xsl:text>DTEND:</xsl:text>
<xsl:call-template name="date-to-hevent">
<xsl:with-param name="date">
<xsl:choose>
<xsl:when test="contains(., 'T')">
<xsl:value-of select="string(.)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="date:add(., 'P1D')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:text>&#13;&#10;</xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="not(string(.) = string(../start))">
<xsl:text>DTEND:</xsl:text>
<xsl:call-template name="date-to-hevent">
<xsl:with-param name="date">
<xsl:choose>
<xsl:when test="contains(., 'T')">
<xsl:value-of select="string(.)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="date:add(., 'P1D')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:text>&#13;&#10;</xsl:text>
</xsl:when>
<xsl:otherwise>
<!-- Fallback duration: two hours -->
<xsl:text>DTDURATION:PT2H&#13;&#10;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="title">