In Progress Bug in contacts provider

Discussion in 'Bugs' started by Marten, Nov 29, 2012.

  1. Marten

    Marten Members

    Trophy Points:
    3
    Hi,

    several users of my app CardDAV-Sync have problems with MIUI. This issue is caused by a bug in your contacts provider. The error occurs when my app commits a chunk of contacts (with ContentResolver.applyBatch). Here is the error message:

    android.database.sqlite.SQLiteException: ambiguous column name: _id (code 1): , while compiling: SELECT deleted, account_id, accounts.account_type, accounts.account_name, accounts.data_set FROM raw_contacts JOIN accounts ON (accounts._id=raw_contacts.account_id) WHERE _id = ?

    Since that is a remote operation the stack trace doesn't contain any information where in your code this error occurs, but I think you should be able to locate this SELECT statement.

    cheers

    Marten
     
  2. divansantana

    divansantana Members

    Trophy Points:
    13
    Thanks Marten!

    MarkHUK/iBotPeaches is this the correct place to report a bug with MIUI?
    Will the MIUI devs look into this?

    CardDAV-Sync app is fantastic but unfortunately doesn't work with MIUI...

    Thanks very much :)
     
  3. Marten

    Marten Members

    Trophy Points:
    3
    Here is a stack trace I received from a user:

    E/DatabaseUtils( 7981): android.database.sqlite.SQLiteException: ambiguous column name: _id (code 1): , while compiling: SELECT deleted, account_id, accounts.account_type, accounts.account_name, accounts.data_set FROM raw_contacts JOIN accounts ON (accounts._id=raw_contacts.account_id) WHERE _id = ?
    E/DatabaseUtils( 7981): at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
    E/DatabaseUtils( 7981): at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:882)
    E/DatabaseUtils( 7981): at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:493)
    E/DatabaseUtils( 7981): at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
    E/DatabaseUtils( 7981): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
    E/DatabaseUtils( 7981): at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
    E/DatabaseUtils( 7981): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
    E/DatabaseUtils( 7981): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
    E/DatabaseUtils( 7981): at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1161)
    E/DatabaseUtils( 7981): at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1032)
    E/DatabaseUtils( 7981): at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1200)
    E/DatabaseUtils( 7981): at com.android.providers.contacts.as.a(CheckSyncFieldHelper.java:68)
    E/DatabaseUtils( 7981): at com.android.providers.contacts.ContactsProvider2.a(ContactsProvider2.java:4403)
    E/DatabaseUtils( 7981): at com.android.providers.contacts.ContactsProvider2.a(ContactsProvider2.java:4323)
    E/DatabaseUtils( 7981): at com.android.providers.contacts.ContactsProvider2.a(ContactsProvider2.java:3976)
    E/DatabaseUtils( 7981): at com.android.providers.contacts.X.update(AbstractContactsProvider.java:145)
    E/DatabaseUtils( 7981): at com.android.providers.contacts.ContactsProvider2.update(ContactsProvider2.java:2085)
    E/DatabaseUtils( 7981): at android.content.ContentProviderOperation.apply(ContentProviderOperation.java:225)
    E/DatabaseUtils( 7981): at com.android.providers.contacts.X.applyBatch(AbstractContactsProvider.java:219)
    E/DatabaseUtils( 7981): at com.android.providers.contacts.ContactsProvider2.applyBatch(ContactsProvider2.java:2204)
    E/DatabaseUtils( 7981): at android.content.ContentProvider$Transport.applyBatch(ContentProvider.java:222)
    E/DatabaseUtils( 7981): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:175)
    E/DatabaseUtils( 7981): at android.os.Binder.execTransact(Binder.java:367)
     
  4. divansantana

    divansantana Members

    Trophy Points:
    13
    Anyone Please??? This is with a SGS2 btw?
     
  5. ingbrzy

    ingbrzy Xiaomi.eu Multilang leader Staff Member

    Trophy Points:
    322
    Optimise your app for MIUI...
     
  6. iBotPeaches

    iBotPeaches Script Gatekeeper Staff Member

    Trophy Points:
    335
    It told you the problem, the code is ambiguous. How is it suppose to know the WHERE field if there is _id in both raw_contacts and accounts. (This is the case in MIUI, not other ROMs).

    Try WHERE accounts._id OR raw_contacts._id (whichever one its suppose to be). MIUI doesn't know what it wants, thus SQLite exception.
     
    divansantana likes this.
  7. divansantana

    divansantana Members

    Trophy Points:
    13
    Thanks iBotPeaches for the helpful reply! We'll see if the app can be updated to address this.
     
  8. Marten

    Marten Members

    Trophy Points:
    3
    Ingbrzy, IBotPeaches did you even read the stack trace? If you don't know how to read stack traces you should not work on a ROM that others install on their devices.

    FYI: That faulty select statement is IN YOUR F*****G CODE!!!

    I'll help you with this: Open CheckSyncFieldHelper.java (it's located in your ContactsProvider) in your IDE and go to line 68. There is a call to SQLiteDatabase.query(...). That call executes the invalid statement. Fix it like IBotPeaches suggested and you're done.

    If you read the stack trace till the end you'll notice that this error occurs during an UPDATE operation. My app didn't even send a "select" query!

    @divansantana, you really should switch to another ROM. It looks like MIUI is developed by ignorant and snotty morons.

    I'm sorry to say that, but bugs in Android ROMs cause me a lot of additional work. Unfortunately MIUI is not the only broken ROM out there. Even manufacturers like HTC and Samsung have plenty of bugs :-|

    How can I re-open this bug ... ?
     
    divansantana likes this.
  9. iBotPeaches

    iBotPeaches Script Gatekeeper Staff Member

    Trophy Points:
    335
    Shit man, calm down. I saw a stack trace, I examined it and posted the fix. Seeing as I maintain Apktool, 5 ports, the entire build scripts, MIUIStats, about 20 official devices, forum moderation, forum updating, and bugs. Its easy for me to miss-skim whatever you said seeing how I do everything for free in my own time.

    To come in here and start insulting me and my staff is not going to get you anywhere. I didn't bother reading the full stacktrace, I assumed you were one of the many developers that come here and bitch at us when its their application coded incorrectly.
     
    divansantana likes this.
  10. divansantana

    divansantana Members

    Trophy Points:
    13
    It's easy to understand how you both frustrated.
    Clearly you both know what's going on and are not used to dealing with competent individuals.

    Thanks Marten for the details.

    iBotPeaches does you and your team have the ability to apply the fix or does it need to be fixed "upstream", what's the process?
     
  11. Marten

    Marten Members

    Trophy Points:
    3
    Ok, please tell me: How should I write a bug report to make you read it more carefully? I mean at least two staff members have read it and all I got were two "fix your code" responses. It takes just one minute to read the stack trace and understand what's going on. When I read "Optimise your app for MIUI..." I know he didn't take that minute. That's an affront to me btw, because it implies I don't know what I'm doing.

    I understand that you're busy with all that stuff. I know how that feels like. >85% of my work is customer support. However I took the time to write that bug report and I expect you to read it carefully before you respond. Otherwise you shouldn't respond at all. That's ok for me because I know that you're either too busy to read it or not interested in fixing it.

    What's a bug tracker good for if you assume that reporters are just incompetent?

    I apologize for my insulting words, but you should probably take bug reports more seriously. Also, I appreciate that you're doing all that in your free time.
     
    divansantana likes this.
  12. divansantana

    divansantana Members

    Trophy Points:
    13
    iBotPeaches/ingbrzy??
     
  13. divansantana

    divansantana Members

    Trophy Points:
    13
    Anyone... ... ...?
     
  14. iBotPeaches

    iBotPeaches Script Gatekeeper Staff Member

    Trophy Points:
    335
    "I expect you to read it carefully before you respond. Otherwise you shouldn't respond at all."

    I don't have time.
     
  15. divansantana

    divansantana Members

    Trophy Points:
    13
    Ok, so to confirm: you and your team want bug reports to be filed, you can fix this bug, have the code to fix this bug, but you all don't have the time?
     
  16. iBotPeaches

    iBotPeaches Script Gatekeeper Staff Member

    Trophy Points:
    335
    He reported the bug, that is good. I haven't had time this week to do anything. We do this for free :p I'm busy with real work this week.
     
  17. divansantana

    divansantana Members

    Trophy Points:
    13
    Ok, I do understand. I just wanted clarity to know where the bug gets fixed and understand where this bug sits, with miui being a chinese developed rom and miuiandroid being a English translation it does get confusing.
     
  18. iBotPeaches

    iBotPeaches Script Gatekeeper Staff Member

    Trophy Points:
    335
    I've passed it upstream. It is out of our control now.
     
    divansantana likes this.
  19. divansantana

    divansantana Members

    Trophy Points:
    13
    Thanks very much.
    Any chance of getting a link if it's public(we can try google translate to watch the status there)?
     
  20. iBotPeaches

    iBotPeaches Script Gatekeeper Staff Member

    Trophy Points:
    335
    divansantana likes this.

Share Our Site