[ https://issues.apache.org/jira/browse/CB-1969?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simon MacDonald resolved CB-1969. --------------------------------- Resolution: Fixed Added the missing column request into the email section of ContactAccessorSdk5.search(). > Searching for emails in Contacts throws an exception always errors out > ---------------------------------------------------------------------- > > Key: CB-1969 > URL: https://issues.apache.org/jira/browse/CB-1969 > Project: Apache Cordova > Issue Type: Bug > Components: Android > Affects Versions: 2.1.0, 2.2.0 > Reporter: Simon MacDonald > Assignee: Simon MacDonald > Priority: Critical > Fix For: 2.3.0 > > > I just upgraded to Cordova 2.2 and now my app crashes whenever I try to look > for contacts. This only happens when "emails" is listed in the fields to > search. I went back to 2.1 and found that although the device did not crash, > it would call the error callback each time. Going back to 2.0 fixes the > issue entirely. I have been testing this on a Galaxy Nexus running Android 4.1 > The code to reproduce: > var contactOptions = new ContactFindOptions(); > contactOptions.filter = searchString; > contactOptions.multiple = true; > var fields = ["displayName", "name", "emails"]; > navigator.contacts.find(fields, callback, function (error) { > alert('error=' + error); }, contactOptions); > The stack trace: > ?:??: W/?(?): threadid=16: thread exiting with uncaught exception > (group=0x41bed300) > ?:??: W/?(?): [ 12-05 09:57:39.230 18818:19071 E/AndroidRuntime ] > ?:??: W/?(?): FATAL EXCEPTION: pool-1-thread-9 > ?:??: W/?(?): java.lang.IllegalStateException: Couldn't read row 5, col -1 > from CursorWindow. Make sure the Cursor is initialized correctly before > accessing data from it. > ?:??: W/?(?): at android.database.CursorWindow.nativeGetString(Native > Method) > ?:??: W/?(?): at > android.database.CursorWindow.getString(CursorWindow.java:434) > ?:??: W/?(?): at > android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51) > ?:??: W/?(?): at > android.database.CursorWrapper.getString(CursorWrapper.java:114) > ?:??: W/?(?): at > org.apache.cordova.ContactAccessorSdk5.emailQuery(ContactAccessorSdk5.java:841) > ?:??: W/?(?): at > org.apache.cordova.ContactAccessorSdk5.populateContactArray(ContactAccessorSdk5.java:401) > ?:??: W/?(?): at > org.apache.cordova.ContactAccessorSdk5.search(ContactAccessorSdk5.java:273) > ?:??: W/?(?): at > org.apache.cordova.ContactManager$1.run(ContactManager.java:79) > ?:??: W/?(?): at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) > ?:??: W/?(?): at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) > ?:??: W/?(?): at java.lang.Thread.run(Thread.java:856) -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira