Failure synchronizing VCARD with empty fields



  • I just installed DavDroid and it failed to sync my contacts. The problem turned out to be VCARDs with empty fields like:

    TEL;TYPE=HOME,VOICE:
    TEL;TYPE=cell,VOICE:
    TEL;TYPE=work,VOICE:
    TEL;TYPE=fax:
    TEL:
    

    Causing:

    EXCEPTION:
    java.lang.NullPointerException: Attempt to get length of null array
    	at at.bitfire.vcard4android.BatchOperation.runBatch(BatchOperation.java:96)
    	at at.bitfire.vcard4android.BatchOperation.commit(BatchOperation.java:55)
    	at at.bitfire.vcard4android.AndroidContact.update(AndroidContact.java:676)
    	at at.bitfire.davdroid.syncadapter.ContactsSyncManager.processVCard(ContactsSyncManager.java:413)
    	at at.bitfire.davdroid.syncadapter.ContactsSyncManager.downloadRemote(ContactsSyncManager.java:351)
    	at at.bitfire.davdroid.syncadapter.SyncManager.performSync(SyncManager.java:170)
    	at at.bitfire.davdroid.syncadapter.ContactsSyncAdapterService$ContactsSyncAdapter.sync(ContactsSyncAdapterService.java:66)
    	at at.bitfire.davdroid.syncadapter.SyncAdapterService$SyncAdapter.onPerformSync(SyncAdapterService.java:85)
    	at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:272)
    
    SOFTWARE INFORMATION
    Package: at.bitfire.davdroid
    Version: 1.3.7.1-gplay (133) Tue Jan 10 07:31:31 GMT+11:00 2017
    Installed from: com.android.vending
    JB Workaround installed: no
    

    against a Radicale 1.1.1 server.

    Filtering the broken fields out of the addressbook makes it work fine, but it seems like they should just be ignored by DAVdroid.


  • developer

    Thanks for the report.

    Do you know which software has generated these VCards? I guess this should be fixed there; at least I don't see any use in empty phone numbers.

    However, as an enhancement, we could check all fields for empty values.


  • developer

    I couldn't reproduce this problem with this VCard in Radicale:

    BEGIN:VCARD
    VERSION:3.0
    PRODID:+//IDN bitfire.at//DAVdroid/1.3.7.1 vcard4android ez-vcard/0.10.1
    UID:e907d3e8-da19-48cc-be41-1d931e3d3159
    FN:Aff Aff
    N:Aff;Aff
    TEL;TYPE=HOME,VOICE:
    TEL;TYPE=cell,VOICE:
    TEL;TYPE=work,VOICE:
    TEL;TYPE=fax:
    TEL:
    REV:2017-01-29T18:21:31Z
    X-RADICALE-NAME:e907d3e8-da19-48cc-be41-1d931e3d3159.vcf
    END:VCARD
    

    Removing FN and N didn't cause an exception, too.

    Please provide steps to reproduce, debug info and verbose logs.



  • @rfc2822 said in Failure synchronizing VCARD with empty fields:

    Thanks for the report.

    Do you know which software has generated these VCards? I guess this should be fixed there; at least I don't see any use in empty phone numbers.

    No, I'm not sure. There have been several clients using this radicale server, and I'm not sure when the bad fields appeared. At least it's been: Evolution on Linux, Thunderbird on Linux, Android via Caldav/Carddav sync, iOS on iPhone.

    @rfc2822 said in Failure synchronizing VCARD with empty fields:

    I couldn't reproduce this problem with this VCard in Radicale:

    BEGIN:VCARD
    VERSION:3.0
    PRODID:+//IDN bitfire.at//DAVdroid/1.3.7.1 vcard4android ez-vcard/0.10.1
    UID:e907d3e8-da19-48cc-be41-1d931e3d3159
    FN:Aff Aff
    N:Aff;Aff
    TEL;TYPE=HOME,VOICE:
    TEL;TYPE=cell,VOICE:
    TEL;TYPE=work,VOICE:
    TEL;TYPE=fax:
    TEL:
    REV:2017-01-29T18:21:31Z
    X-RADICALE-NAME:e907d3e8-da19-48cc-be41-1d931e3d3159.vcf
    END:VCARD
    

    Removing FN and N didn't cause an exception, too.

    Please provide steps to reproduce, debug info and verbose logs.

    That's always annoying. Here's an exact VCARD that if added to my sharedcontacts.vcf causes a sync error:

    BEGIN:VCARD
    VERSION:3.0
    UID:https://user@ourdomain.com.au/path/sharedcontacts.vcf/0145BC8B-045A4874-577A6C9E.vcf
    N:Person;A;;;;
    FN:A Person
    ADR;TYPE=home:;;8 Some St\,;;;5454;
    ADR;TYPE=work:;;;;;;
    TEL;TYPE=HOME,VOICE:
    TEL;TYPE=cell,VOICE:
    TEL;TYPE=work,VOICE:
    TEL;TYPE=fax:
    TEL:
    BDAY:1986-01-01
    EMAIL;TYPE=PREF,INTERNET,OTHER:broken@
    EMAIL;TYPE=PREF,INTERNET,OTHER:
    X-RADICALE-NAME:0145BC8B-045A4874-577A6C9E.vcf
    END:VCARD
    

    If I remove the TEL; and TEL: fields it syncs without error. Any chance you're adding an extra ^M or so in your lines that makes the end field not-quite-empty?

    Here's the relevant part of the debug log:

    2017-01-30 12:01:35 2 [syncadapter.SyncManager] Downloading remote entries
    2017-01-30 12:01:35 2 [syncadapter.ContactsSyncManager] Downloading 1 contacts (10 at once)
    2017-01-30 12:01:35 2 [syncadapter.ContactsSyncManager] Downloading https://ourdomain.com.au/path/sharedcontacts.vcf/0145BC8B-045A4874-577A6C9E.vcf
    2017-01-30 12:01:35 2 [HttpClient$1] --> GET https://ourdomain.com.au/path/sharedcontacts.vcf/0145BC8B-045A4874-577A6C9E.vcf http/1.1
    2017-01-30 12:01:35 2 [HttpClient$1] Accept: text/vcard;version=4.0, text/vcard;charset=utf-8;q=0.8, text/vcard;q=0.5
    2017-01-30 12:01:35 2 [HttpClient$1] Accept-Encoding: identity
    2017-01-30 12:01:35 2 [HttpClient$1] --> END GET
    2017-01-30 12:01:35 2 [dav4android.BasicDigestAuthHandler] Adding Basic authorization header for https://ourdomain.com.au/path/sharedcontacts.vcf/0145BC8B-045A4874-577A6C9E.vcf
    2017-01-30 12:01:35 2 [HttpClient$1] <-- 200 OK https://ourdomain.com.au/path/sharedcontacts.vcf/0145BC8B-045A4874-577A6C9E.vcf (51ms)
    2017-01-30 12:01:35 2 [HttpClient$1] Date: Mon, 30 Jan 2017 01:01:24 GMT
    2017-01-30 12:01:35 2 [HttpClient$1] Server: Apache/2.4.18 (Ubuntu)
    2017-01-30 12:01:35 2 [HttpClient$1] ETag: "528812456f85cc3caba6b7de50695047"
    2017-01-30 12:01:35 2 [HttpClient$1] Last-Modified: Mon, 30 Jan 2017 01:00:15 GMT
    2017-01-30 12:01:35 2 [HttpClient$1] Content-Length: 786
    2017-01-30 12:01:35 2 [HttpClient$1] Keep-Alive: timeout=5, max=97
    2017-01-30 12:01:35 2 [HttpClient$1] Connection: Keep-Alive
    2017-01-30 12:01:35 2 [HttpClient$1] Content-Type: text/vcard
    2017-01-30 12:01:35 2 [HttpClient$1] 
    2017-01-30 12:01:35 2 [HttpClient$1] BEGIN:VCARD
    VERSION:3.0
    UID:https://user@ourdomain.com.au/path/sharedcontacts.vcf/0145BC8B-045A4874-577A6C9E.vcf
    N:Person;A;;;;
    FN:A Person
    ADR;TYPE=home:;;8 Some St\,;;;5454;
    ADR;TYPE=work:;;;;;;
    TEL;TYPE=HOME,VOICE:
    TEL;TYPE=cell,VOICE:
    TEL;TYPE=work,VOICE:
    TEL;TYPE=fax:
    TEL:
    BDAY:1986-01-01
    EMAIL;TYPE=PREF,INTERNET,OTHER:broken@
    EMAIL;TYPE=PREF,INTERNET,OTHER:
    X-RADICALE-NAME:0145BC8B-045A4874-577A6C9E.vcf
    END:VCARD
    BEGIN:VCARD
    UID:https://user@ourdomain.com.au/path/sharedcontacts.vcf/0145BC8B-045A4874-577A6C9E.vcf
    N:Person;A;;;;
    FN:A Person
    ADR;TYPE=home:;;8 Some St,;;;5454;
    ADR;TYPE=work:;;;;;;
    TEL;TYPE=HOME,VOICE:
    TEL;TYPE=cell,VOICE:
    TEL;TYPE=work,VOICE:
    TEL;TYPE=fax:
    TEL:
    BDAY:1986-01-01
    EMAIL;TYPE=PREF,INTERNET,OTHER:broken@
    EMAIL;TYPE=PREF,INTERNET,OTHER:
    X-RADICALE-NAME:0145BC8B-045A4874-577A6C9E.vcf
    END:VCARD
    2017-01-30 12:01:35 2 [HttpClient$1] <-- END HTTP (786-byte body)
    2017-01-30 12:01:35 2 [syncadapter.ContactsSyncManager] Processing CardDAV resource 0145BC8B-045A4874-577A6C9E.vcf
    2017-01-30 12:01:35 2 [vcard4android.Contact] Received VCard without UID, generating new one
    2017-01-30 12:01:35 2 [vcard4android.Contact] Received VCard without UID, generating new one
    2017-01-30 12:01:35 2 [syncadapter.ContactsSyncManager] Received multiple VCards, using first one
    2017-01-30 12:01:35 2 [syncadapter.ContactsSyncManager] Updating 0145BC8B-045A4874-577A6C9E.vcf in local address book
    	PARAMETER #1 = Contact(uid=bfbdd6b8-5d96-49b9-9435-930e79efa1f8, displayName=A Person, givenName=A, familyName=Person)
    2017-01-30 12:01:35 2 [vcard4android.AndroidContact] Built RawContact data row
    	PARAMETER #1 = mType: 2, mUri: content://com.android.contacts/raw_contacts/809?account_name=WG%20Shared&account_type=bitfire.at.davdroid&caller_is_syncadapter=true, mSelection: null, mExpectedCount: null, mYieldAllowed: false, mValues: sync2=528812456f85cc3caba6b7de50695047 deleted=0 sync1=bfbdd6b8-5d96-49b9-9435-930e79efa1f8 sourceid=0145BC8B-045A4874-577A6C9E.vcf dirty=0, mValuesBackReferences: null, mSelectionArgsBackReferences: null
    2017-01-30 12:01:35 2 [vcard4android.AndroidContact] Built StructuredName data row
    	PARAMETER #1 = mType: 1, mUri: content://com.android.contacts/data?account_name=WG%20Shared&account_type=bitfire.at.davdroid&caller_is_syncadapter=true, mSelection: null, mExpectedCount: null, mYieldAllowed: false, mValues: data9=null raw_contact_id=809 data5=null data8=null data1=A Person data6=null data2=A data4=null data3=Person data7=null mimetype=vnd.android.cursor.item/name, mValuesBackReferences: null, mSelectionArgsBackReferences: null
    2017-01-30 12:01:35 2 [vcard4android.AndroidContact] Built Phone data row
    	PARAMETER #1 = mType: 1, mUri: content://com.android.contacts/data?account_name=WG%20Shared&account_type=bitfire.at.davdroid&caller_is_syncadapter=true, mSelection: null, mExpectedCount: null, mYieldAllowed: false, mValues: raw_contact_id=809 is_primary=0 data3=null data1= data2=1 is_super_primary=0 mimetype=vnd.android.cursor.item/phone_v2, mValuesBackReferences: null, mSelectionArgsBackReferences: null
    2017-01-30 12:01:35 2 [vcard4android.AndroidContact] Built Phone data row
    	PARAMETER #1 = mType: 1, mUri: content://com.android.contacts/data?account_name=WG%20Shared&account_type=bitfire.at.davdroid&caller_is_syncadapter=true, mSelection: null, mExpectedCount: null, mYieldAllowed: false, mValues: raw_contact_id=809 is_primary=0 data3=null data1= data2=2 is_super_primary=0 mimetype=vnd.android.cursor.item/phone_v2, mValuesBackReferences: null, mSelectionArgsBackReferences: null
    2017-01-30 12:01:35 2 [vcard4android.AndroidContact] Built Phone data row
    	PARAMETER #1 = mType: 1, mUri: content://com.android.contacts/data?account_name=WG%20Shared&account_type=bitfire.at.davdroid&caller_is_syncadapter=true, mSelection: null, mExpectedCount: null, mYieldAllowed: false, mValues: raw_contact_id=809 is_primary=0 data3=null data1= data2=3 is_super_primary=0 mimetype=vnd.android.cursor.item/phone_v2, mValuesBackReferences: null, mSelectionArgsBackReferences: null
    2017-01-30 12:01:35 2 [vcard4android.AndroidContact] Built Phone data row
    	PARAMETER #1 = mType: 1, mUri: content://com.android.contacts/data?account_name=WG%20Shared&account_type=bitfire.at.davdroid&caller_is_syncadapter=true, mSelection: null, mExpectedCount: null, mYieldAllowed: false, mValues: raw_contact_id=809 is_primary=0 data3=null data1= data2=13 is_super_primary=0 mimetype=vnd.android.cursor.item/phone_v2, mValuesBackReferences: null, mSelectionArgsBackReferences: null
    2017-01-30 12:01:35 2 [vcard4android.AndroidContact] Built Phone data row
    	PARAMETER #1 = mType: 1, mUri: content://com.android.contacts/data?account_name=WG%20Shared&account_type=bitfire.at.davdroid&caller_is_syncadapter=true, mSelection: null, mExpectedCount: null, mYieldAllowed: false, mValues: raw_contact_id=809 is_primary=0 data3=null data1= data2=7 is_super_primary=0 mimetype=vnd.android.cursor.item/phone_v2, mValuesBackReferences: null, mSelectionArgsBackReferences: null
    2017-01-30 12:01:35 2 [vcard4android.AndroidContact] Built Email data row
    	PARAMETER #1 = mType: 1, mUri: content://com.android.contacts/data?account_name=WG%20Shared&account_type=bitfire.at.davdroid&caller_is_syncadapter=true, mSelection: null, mExpectedCount: null, mYieldAllowed: false, mValues: raw_contact_id=809 is_primary=1 data3=Internet data1=broken@ data2=0 is_super_primary=1 mimetype=vnd.android.cursor.item/email_v2, mValuesBackReferences: null, mSelectionArgsBackReferences: null
    2017-01-30 12:01:35 2 [vcard4android.AndroidContact] Built Email data row
    	PARAMETER #1 = mType: 1, mUri: content://com.android.contacts/data?account_name=WG%20Shared&account_type=bitfire.at.davdroid&caller_is_syncadapter=true, mSelection: null, mExpectedCount: null, mYieldAllowed: false, mValues: raw_contact_id=809 is_primary=1 data3=Internet data1= data2=0 is_super_primary=1 mimetype=vnd.android.cursor.item/email_v2, mValuesBackReferences: null, mSelectionArgsBackReferences: null
    2017-01-30 12:01:35 2 [vcard4android.AndroidContact] Built StructuredPostal data row
    	PARAMETER #1 = mType: 1, mUri: content://com.android.contacts/data?account_name=WG%20Shared&account_type=bitfire.at.davdroid&caller_is_syncadapter=true, mSelection: null, mExpectedCount: null, mYieldAllowed: false, mValues: data9=5454 raw_contact_id=809 data5=null data8=null data1=8 Some St,
    5454 data6=null data2=1 data10=null data4=8 Some St, data3=null data7=null mimetype=vnd.android.cursor.item/postal-address_v2, mValuesBackReferences: null, mSelectionArgsBackReferences: null
    2017-01-30 12:01:35 2 [vcard4android.AndroidContact] Built StructuredPostal data row
    	PARAMETER #1 = mType: 1, mUri: content://com.android.contacts/data?account_name=WG%20Shared&account_type=bitfire.at.davdroid&caller_is_syncadapter=true, mSelection: null, mExpectedCount: null, mYieldAllowed: false, mValues: data9=null raw_contact_id=809 data5=null data8=null data1= data6=null data2=2 data10=null data4=null data3=null data7=null mimetype=vnd.android.cursor.item/postal-address_v2, mValuesBackReferences: null, mSelectionArgsBackReferences: null
    2017-01-30 12:01:35 2 [vcard4android.AndroidContact] Built Event data row
    	PARAMETER #1 = mType: 1, mUri: content://com.android.contacts/data?account_name=WG%20Shared&account_type=bitfire.at.davdroid&caller_is_syncadapter=true, mSelection: null, mExpectedCount: null, mYieldAllowed: false, mValues: raw_contact_id=809 data1=1986-01-01 data2=3 mimetype=vnd.android.cursor.item/contact_event, mValuesBackReferences: null, mSelectionArgsBackReferences: null
    2017-01-30 12:01:35 2 [vcard4android.BatchOperation] Committing 14 operations …
    2017-01-30 12:01:35 2 [vcard4android.BatchOperation] Running operations 0 to 13
    2017-01-30 12:01:35 2 [syncadapter.SyncManager] Unknown sync error
    EXCEPTION java.lang.NullPointerException: Attempt to get length of null array
    	at at.bitfire.vcard4android.BatchOperation.runBatch(BatchOperation.java:96)
    	at at.bitfire.vcard4android.BatchOperation.commit(BatchOperation.java:55)
    	at at.bitfire.vcard4android.AndroidContact.update(AndroidContact.java:676)
    	at at.bitfire.davdroid.syncadapter.ContactsSyncManager.processVCard(ContactsSyncManager.java:413)
    	at at.bitfire.davdroid.syncadapter.ContactsSyncManager.downloadRemote(ContactsSyncManager.java:320)
    	at at.bitfire.davdroid.syncadapter.SyncManager.performSync(SyncManager.java:170)
    	at at.bitfire.davdroid.syncadapter.ContactsSyncAdapterService$ContactsSyncAdapter.sync(ContactsSyncAdapterService.java:66)
    	at at.bitfire.davdroid.syncadapter.SyncAdapterService$SyncAdapter.onPerformSync(SyncAdapterService.java:85)
    	at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:272)
    
    2017-01-30 12:01:35 2 [syncadapter.ContactsSyncAdapterService$ContactsSyncAdapter] Address book sync complete
    2017-01-30 12:01:35 2 [syncadapter.SyncAdapterService$SyncAdapter] Sync for com.android.contacts complete

  • developer

    I'll try this VCard later.

    There seems to be another server bug, too. When DAVdroid requests https://ourdomain.com.au/path/sharedcontacts.vcf/0145BC8B-045A4874-577A6C9E.vcf, Radicale seems to send two VCARDs (in which case DAVdroid ignores all but the first one). This should not happen, because "Address object resources contained in address book collections MUST contain a single vCard component only".


  • developer

    Can't reproduce the problem with your VCard and our Android 4.4 testing device here. Maybe with another Android version… what's yours? Debug info should contain it, but it seems to be cut off.



  • @rfc2822 said in Failure synchronizing VCARD with empty fields:

    I'll try this VCard later.

    There seems to be another server bug, too. When DAVdroid requests https://ourdomain.com.au/path/sharedcontacts.vcf/0145BC8B-045A4874-577A6C9E.vcf, Radicale seems to send two VCARDs (in which case DAVdroid ignores all but the first one). This should not happen, because "Address object resources contained in address book collections MUST contain a single vCard component only".

    That's probably my fault - I manually tacked the broken VCARD onto the vcf file but forgot to remove the "fixed" VCARD first



  • @rfc2822 said in Failure synchronizing VCARD with empty fields:

    Can't reproduce the problem with your VCard and our Android 4.4 testing device here. Maybe with another Android version… what's yours? Debug info should contain it, but it seems to be cut off.

    SYSTEM INFORMATION
    Android version: 6.0.1 (ZTE A2017GV1.0.0B08)
    Device: ZTE ZTE A2017G (ailsa_ii)


  • developer

    I could neither reproduce with Android 4.4 (Samsung Galaxy Note 10.1) nor with Android 6.0 (CM 13.0-20161228), using Radicale and your VCard (tried with CRLF and only LF line breaks).

    So I guess that's something firmware specific…


Log in to reply
 

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