Can't edit existing carddav contacts -> com.android.contacts crashs



  • Use Case 1:

    1. Upload the address book via another carddav client (SOGo Connector for example)
    2. Sync it with DAVdroid
    3. Switch to "Contacts to display" and select the DAVdroid Account
    4. Select an existing contact and edit it
      --> com.android.contacts app crashs.
    03-16 14:37:57.525    6494-6494/com.android.contacts E/AndroidRuntime﹕ FATAL EXCEPTION: main
        java.lang.NullPointerException
                at com.android.contacts.editor.ContactEditorFragment$EntityDeltaComparator.compare(ContactEditorFragment.java:1319)
                at com.android.contacts.editor.ContactEditorFragment$EntityDeltaComparator.compare(ContactEditorFragment.java:1276)
                at java.util.TimSort.binarySort(TimSort.java:261)
                at java.util.TimSort.sort(TimSort.java:186)
                at java.util.TimSort.sort(TimSort.java:169)
                at java.util.Arrays.sort(Arrays.java:2038)
                at java.util.Collections.sort(Collections.java:1891)
                at com.android.contacts.editor.ContactEditorFragment.bindEditors(ContactEditorFragment.java:682)
                at com.android.contacts.editor.ContactEditorFragment.bindEditorsForExistingContact(ContactEditorFragment.java:510)
                at com.android.contacts.editor.ContactEditorFragment.setData(ContactEditorFragment.java:469)
                at com.android.contacts.editor.ContactEditorFragment$4.onLoadFinished(ContactEditorFragment.java:1715)
                at com.android.contacts.editor.ContactEditorFragment$4.onLoadFinished(ContactEditorFragment.java:1694)
                at android.app.LoaderManagerImpl$LoaderInfo.callOnLoadFinished(LoaderManager.java:482)
                at android.app.LoaderManagerImpl$LoaderInfo.onLoadComplete(LoaderManager.java:450)
                at android.content.Loader.deliverResult(Loader.java:143)
                at com.android.contacts.ContactLoader.deliverResult(ContactLoader.java:1248)
                at com.android.contacts.ContactLoader.deliverResult(ContactLoader.java:74)
                at android.content.AsyncTaskLoader.dispatchOnLoadComplete(AsyncTaskLoader.java:254)
                at android.content.AsyncTaskLoader$LoadTask.onPostExecute(AsyncTaskLoader.java:91)
                at android.os.AsyncTask.finish(AsyncTask.java:631)
                at android.os.AsyncTask.access$600(AsyncTask.java:177)
                at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
                at android.os.Handler.dispatchMessage(Handler.java:99)
                at android.os.Looper.loop(Looper.java:137)
                at android.app.ActivityThread.main(ActivityThread.java:4931)
                at java.lang.reflect.Method.invokeNative(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:511)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
                at dalvik.system.NativeStart.main(Native Method)
    

    Use Case 2)

    1. Switch to "Contacts to display" and select DAVdroid Account
    2. Add a new contact (Android says the contact will be synced)
    3. Save contact
    4. Edit the new contact
      --> all works as intended

    No HTC :)
    SEMC Xperia Pro Android 4.1.2 (API 16) CyanogenMod 10.1

    @Edit
    Only contacts that are similar to the local contacts will crash, if i remove these contacts, all works fine.
    In my case i remove my complete contacts

    • Navigate to Settings--->Apps--->Contacts Storage
    • Now Click Clear data

    and get all contacts via carddav ...


  • developer

    Can you provide (a link to) the source code of the exact version of your com.android.contacts? Otherwise, the line numbers in the exception messages are useless.

    Setting this to "3rd-party bug" because it's not DAVdroid that crashes but the contacts editor (and I didn't see that here yet, even when testing with SoGo)



  • Okay, here you can find the (hopefully) right source code from cm
    https://github.com/CyanogenMod/android_packages_apps_Contacts/blob/b5027d80bd5eff9dadb8d63004dbe3aede41be10/src/com/android/contacts/editor/ContactEditorFragment.java
    Btw thats my rom i installed: cm-10-20131006-NIGHTLY-iyokan.zip



  • I experienced also problems where the contact editor just crashes when I tried to setup DAVdroid + Horde:

    • I exported my contacts to a vcf file to have a backup
    • installed davdroid
    • tried to move contacts (local / gmail) to DAVdroid account. I found no possibility to do this.
    • import backuped vcf file. done. It seems that nothing happend
    • till now the contact editor crashes
    • I also had problems with events in the calender (using aCalender App)

    I seems that now contacts have multiple "resource providers" / accounts and the apps can not handle this...?!
    I hope this notice could be helpful..

    knut

    OS: CM 10.1.3-i9100g


  • developer

    @h8h: According to the exception, there's a NullPointerException at com.android.contacts.editor.ContactEditorFragment$EntityDeltaComparator.compare(ContactEditorFragment.java:1319) which is called from at com.android.contacts.editor.ContactEditorFragment$EntityDeltaComparator.compare(ContactEditorFragment.java:1276). However, in the source code you posted line 1276 is not in the compare() method but onEditOtherContactRequested. So I guess that's not the correct source code version.

    @voxspox: Can you try to remove all your contacts (after exporting them, of course, and testing if the exported VCF is actually working)? If the problem then disappears, you'd have to import the contacts in bunches until the contact editor begins to crash again.



  • @rfc2822 I see ... wrong source, damn nightbuilds ... The proposal for deleting all the contacts was the workaround to solve this problem. I removed all my contacts and uploaded the exported vcf to the carddav server and for my mobile i let davdroid import the contacts from the carddav server. Now i can add edit and delete my whole contacts without any nullpointer problems.


  • developer

    Ok, so I'll close this. If this issue persists and if you think that DAVdroid could do something better, please post here again and I'll re-open.


Log in to reply
 

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