DAVdroid crash with calendar sync (space in URL)



  • AndroidRuntime( 9245): java.lang.IllegalArgumentException: Illegal character in path at index 50: /xy/remote.php/calendar/calendars/username/default calendar/
    AndroidRuntime( 9245): 	at java.net.URI.create(URI.java:727)
    AndroidRuntime( 9245): 	at java.net.URI.resolve(URI.java:1239)
    AndroidRuntime( 9245): 	at at.bitfire.davdroid.syncadapter.CalendarsSyncAdapterService$SyncAdapter.getSyncPairs(CalendarsSyncAdapterService.java:71)
    AndroidRuntime( 9245): 	at at.bitfire.davdroid.syncadapter.DavSyncAdapter.onPerformSync(DavSyncAdapter.java:48)
    AndroidRuntime( 9245): 	at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:254)```
    
    I'm running DAVdroid 0.3.6-alpha with OwnCloud 4.0.6. DAVdroid crashes before contacting OwnCloud.
    Contacts are syncing correctly.

  • admin

    Can you try it again please with 0.3.7-alpha?



  • Still the same problem:

    AndroidRuntime( 7007): java.lang.IllegalArgumentException: Illegal character in path at index 48: /xx/remote.php/calendar/calendars/userxx/default calendar/
    AndroidRuntime( 7007): 	at java.net.URI.create(URI.java:727)
    AndroidRuntime( 7007): 	at java.net.URI.resolve(URI.java:1239)
    AndroidRuntime( 7007): 	at at.bitfire.davdroid.syncadapter.CalendarsSyncAdapterService$SyncAdapter.getSyncPairs(CalendarsSyncAdapterService.java:71)
    AndroidRuntime( 7007): 	at at.bitfire.davdroid.syncadapter.DavSyncAdapter.onPerformSync(DavSyncAdapter.java:48)
    AndroidRuntime( 7007): 	at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:254)```
    
    (I restarted my phone after installing 0.3.7 and added a new account to test.)


  • java.net.URI.resolve expects a encoded URI string.

    According to the reference (http://developer.android.com/reference/java/net/URI.html) a space is not a valid character in a URI.
    The string should be encoded either in SyncAdapterService (both calendar as contact) or when saving the URI during account setup.
    @upaternostro proposes the first option in #49.


  • developer

    Should be fixed with 0.3.8 by intelligent URL repairing, please test. And please don't forget to contact your server manufacturer because spaces in URLs are invalid and must not occur.



  • It is not fixed in 0.3.8.
    Relevant logcat for adding the account:

    davdroid.WebDavResource( 3721): Received multistatus response: <?xml version="1.0" encoding="utf-8"?>
    davdroid.WebDavResource( 3721): <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/"><d:response><d:href>/xx/remote.php/calendar/calendars/usr/</d:href><d:propstat><d:prop><d:resourcetype><d:collection/></d:resourcetype></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><x4:addressbook-description xmlns:x4="urn:ietf:params:xml:ns:carddav"/><x5:calendar-color xmlns:x5="http://apple.com/ns/ical/"/><cal:calendar-description/><d:displayname/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/xx/remote.php/calendar/calendars/usr/default%20calendar/</d:href><d:propstat><d:prop><d:displayname>Default calendar</d:displayname><d:resourcetype><d:collection/><cal:calendar/></d:resourcetype></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><x4:addressbook-description xmlns:x4="urn:ietf:params:xml:ns:carddav"/><x5:calendar-color xmlns:x5="http://apple.com/ns/ical/"/><cal:calendar-description/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/xx/remote.php/calendar/calendars/usr/outbox/</d:href><d:propstat><d:prop><d:resourcetype><d:collection/><cal:schedule-outbox/></d:resourcetype></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><x4:addressbook-description xmlns:x4="urn:ietf:params:xml:ns:carddav"/><x5:calendar-color xmlns:x5="http://apple.com/ns/ical/"/><cal:calendar-description/><d:displayname/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response></d:multistatus>
    davdroid.URIUtils( 3721): Tried to repair invalid URL/URL path: /xx/remote.php/calendar/calendars/usr/default calendar/ -> /xx/remote.php/calendar/calendars/usr/default%20calendar/
    davdroid.ServerInfoLoader( 3721): Found calendar: /xx/remote.php/calendar/calendars/usr/default calendar/
    

    Note that it is saved as .../default calendar/ in stead of .../default%20calendar/.

    Sync logcat:

    AndroidRuntime( 4123): FATAL EXCEPTION: SyncAdapterThread-1
    AndroidRuntime( 4123): java.lang.IllegalArgumentException: Illegal character in path at index 45: /xx/remote.php/calendar/calendars/usr/default calendar/
    AndroidRuntime( 4123): 	at java.net.URI.create(URI.java:727)
    AndroidRuntime( 4123): 	at java.net.URI.resolve(URI.java:1239)
    AndroidRuntime( 4123): 	at at.bitfire.davdroid.syncadapter.CalendarsSyncAdapterService$SyncAdapter.getSyncPairs(CalendarsSyncAdapterService.java:71)
    AndroidRuntime( 4123): 	at at.bitfire.davdroid.syncadapter.DavSyncAdapter.onPerformSync(DavSyncAdapter.java:48)
    AndroidRuntime( 4123): 	at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:254)


  • I can confirm this.

    I still have to run with my patches to make DAVDroid work against OwnClous 4.5.5

    BTW, same error here



  • In QueryServerDialogFragment.java getPath() is used. According to the reference getPath()

    Returns the decoded path of this URI, or null if this URI has no path.
    

    When the URI is created during the sync process java.net.URI.resolve is used which requires an encoded URI String.
    getRawPath() is the correct method. According to the reference

    Returns the encoded path of this URI, or null if this URI has no path.

  • developer

    @sturlig Thanks, will change it as soon as I find time.


Log in to reply
 

Looks like your connection to Bitfire App Forums was lost, please wait while we try to reconnect.