If Im.PROTOCOL_CUSTOM is set but Im.CUSTOM_PROTOCOL is empty syncing fails



  • First of all, thanks for davdroid! Been using it happily for years now.

    I used a suboptimal contact merger which apparently corrupted some contacts. It seems that for a contact the PROTOCOL_CUSTOM field is set but CUSTOM_PROTOCOL is empty.

    Which results in IllegalStateException (see log below) in vcard4android AndroidContact.kt #L348

    I understand that according to the [Protocol documentation] (https://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.Im.html#PROTOCOL) the CUSTOM_PROTOCOL should contain the name of the custom protocol if PROTOCOL_CUSTOM is set, but it would be nice to just sync and log a warning similar to the IllegalArgumentException. Currently nothing is synced because of single corrupt contact.

    • If I can provide anymore info, please let me know

    **Debug log (without my personal info) **

    SYNCHRONIZATION INFO
    Synchronization phase: 0
    Account name: Default (bla@bla.com ag)
    Authority: com.android.contacts
    
    EXCEPTION:
    java.lang.IllegalStateException: row.getAsString(Im.CUSTOM_PROTOCOL) must not be null
    	at at.bitfire.vcard4android.AndroidContact.populateIMPP(AndroidContact.kt:348)
    	at at.bitfire.vcard4android.AndroidContact.getContact(AndroidContact.kt:144)
    	at at.bitfire.davdroid.resource.LocalContact.dataHashCode$app_standardRelease(LocalContact.kt:155)
    	at at.bitfire.davdroid.resource.LocalAddressBook.verifyDirty(LocalAddressBook.kt:193)
    	at at.bitfire.davdroid.syncadapter.ContactsSyncManager.prepare(ContactsSyncManager.kt:104)
    	at at.bitfire.davdroid.syncadapter.SyncManager.performSync(SyncManager.kt:107)
    	at at.bitfire.davdroid.syncadapter.ContactsSyncAdapterService$ContactsSyncAdapter.sync(ContactsSyncAdapterService.kt:43)
    	at at.bitfire.davdroid.syncadapter.SyncAdapterService$SyncAdapter.onPerformSync(SyncAdapterService.kt:47)
    	at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:272)
    
    SOFTWARE INFORMATION
    DAVdroid version: 1.6.4-ose (158) Sat Jul 29 02:20:12 GMT+02:00 2017
    Installed from: com.google.android.packageinstaller
    JB Workaround installed: no
    
    CONNECTIVITY (at the moment)
    Active connection: WiFi, CONNECTED
    System default proxy: none
    
    CONFIGURATION
    Power saving disabled: no
    android.permission.READ_CONTACTS permission: granted
    android.permission.WRITE_CONTACTS permission: granted
    android.permission.READ_CALENDAR permission: granted
    android.permission.WRITE_CALENDAR permission: granted
    org.dmfs.permission.READ_TASKS permission: denied
    org.dmfs.permission.WRITE_TASKS permission: denied
    System-wide synchronization: automatically
    Account: bla@hotmail.com 
      Address book sync. interval: 240 min
      Calendar     sync. interval: —
      OpenTasks    sync. interval: —
      WiFi only: false
      [CardDAV] Contact group method: GROUP_VCARDS
      [CalDAV] Time range (past days): 90
               Manage calendar colors: true
    Account: bla@hotmail.com - caldav
      Address book sync. interval: —
      Calendar     sync. interval: 240 min
      OpenTasks    sync. interval: —
      WiFi only: false
      [CardDAV] Contact group method: GROUP_VCARDS
      [CalDAV] Time range (past days): 90
               Manage calendar colors: true
    Address book account: Default ( ag)
      Main account: Account {name=, type=bitfire.at.davdroid}
      URL: 
      Sync automatically: true
    
    SQLITE DUMP
    android_metadata
    	|  locale |
    	|  nl_NL |
    ----------
    settings
    	|  setting | value |
    	|  hint_OpenTasksNotInstalled | 0 |
    ----------
    services
    	|  _id | accountName | service | principal |
    	|  1 |  | carddav | /use |
    	|  2 |  - caldav | caldav  |
    ----------
    sqlite_sequence
    	|  name | seq |
    	|  services | 2 |
    	|  homesets | 4 |
    	|  collections | 6 |
    ----------
    homesets
    	|  _id | serviceID | url |
    	|  2 | 2  |
    	|  4 |  |
    ----------
    collections
    	|  _id | serviceID | url | readOnly | displayName | description | color | timezone | supportsVEVENT | supportsVTODO | sync |
    	|  2 | 2 |  | 0 |  Calendar | <null> | -12959076 | <null> | 1 | 1 | 1 |
    	|  3 | 2  | 1 | @gmail.com | <null> | -10610867 | <null> | 1 | 1 | 1 |
    	|  4 | 2  | 1 | @gmail.com | <null> | -1092591 | <null> | 1 | 1 | 1 |
    	|  6 | 1  | 0 | Default | <null> | <null> | <null> | 0 | 0 | 1 |
    ----------
    
    SYSTEM INFORMATION
    Android version: 7.1.1 (ONEPLUS A5000_23_170803)
    Device: OnePlus ONEPLUS A5000 (OnePlus5)
    
    
    

  • developer

    Thanks for the report. Did you already report it to the contact merger, too?



  • @rfc2822
    next step :)


  • developer

    There's no need to ignore such entries. IMPP without protocol should be coded as URI without scheme, e.g. just nickname. This is not a problem of creating the URI, but of AndroidContact.toURIScheme() not accepting null values.

    Fixed with vcard4android/48c64fc8.



  • Thanks for the quick resolution, enjoy your :beer:, see your paypal ;).


Log in to reply
 

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