You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/01/06 14:33:58 UTC
[jira] [Commented] (CB-12326) Crash on Android:
CommonDataKinds.*.LABEL
[ https://issues.apache.org/jira/browse/CB-12326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15804650#comment-15804650 ]
ASF GitHub Bot commented on CB-12326:
-------------------------------------
GitHub user mad-nuts opened a pull request:
https://github.com/apache/cordova-plugin-contacts/pull/146
CB-12326
fix:
Crash on Android: CommonDataKinds.*.LABEL
<!--
Please make sure the checklist boxes are all checked before submitting the PR. The checklist
is intended as a quick reference, for complete details please see our Contributor Guidelines:
http://cordova.apache.org/contribute/contribute_guidelines.html
Thanks!
-->
### Platforms affected
Android
### What does this PR do?
Adding the missing "LABEL" CommonDataKinds columns to the ContactAccessorSdk5 to fix the app crash issue.
Moving the label type queries inside the try catch blocks, replacing the "getColumnIndex" with "getColumnIndexOrThrow" and catching the IllegalArgumentExceptions handler to make the code more solid.
### What testing has been done on this change?
Tested on Samsung Galaxy S6
### Checklist
- [ Yes ] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
- [ Yes ] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
- [ No ] Added automated test coverage as appropriate for this change.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/mad-nuts/cordova-plugin-contacts master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cordova-plugin-contacts/pull/146.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #146
----
commit 3bb509e1f473531354b70fd299ba2003905d3f5b
Author: andreas.kausler <an...@camao.de>
Date: 2017-01-06T13:59:21Z
CB-12326
fix:
Crash on Android: CommonDataKinds.*.LABEL
----
> Crash on Android: CommonDataKinds.*.LABEL
> -----------------------------------------
>
> Key: CB-12326
> URL: https://issues.apache.org/jira/browse/CB-12326
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin Contacts
> Environment: Android: Samsung Galaxy S6
> Reporter: Andreas
> Priority: Critical
> Labels: Android, crash, reproduced
>
> The ContactAccessorSdk5 is missing the "LABEL" CommonDataKinds column definition for multple Cursors, causing the "search" function to crash.
> {code:title=is|borderStyle=solid}
> if (isRequired("emails", populate)) {
> columnsToFetch.add(CommonDataKinds.Email._ID);
> columnsToFetch.add(CommonDataKinds.Email.DATA);
> columnsToFetch.add(CommonDataKinds.Email.TYPE);
> }
> {code}
> {code:title=should be|borderStyle=solid}
> if (isRequired("emails", populate)) {
> columnsToFetch.add(CommonDataKinds.Email._ID);
> columnsToFetch.add(CommonDataKinds.Email.DATA);
> columnsToFetch.add(CommonDataKinds.Email.TYPE);
> columnsToFetch.add(CommonDataKinds.Email.LABEL);
> }
> {code}
> missing columns are:
> - CommonDataKinds.Phone.LABEL
> - CommonDataKinds.Email.LABEL
> - CommonDataKinds.StructuredPostal.LABEL
> - CommonDataKinds.Organization.LABEL
> - CommonDataKinds.Website.LABEL
> 01-06 13:43:03.871 7333 7527 E AndroidRuntime: java.lang.IllegalStateException: Couldn't read row 174, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
> 01-06 13:43:03.871 7333 7527 E AndroidRuntime: at android.database.CursorWindow.nativeGetString(Native Method)
> 01-06 13:43:03.871 7333 7527 E AndroidRuntime: at android.database.CursorWindow.getString(CursorWindow.java:451)
> 01-06 13:43:03.871 7333 7527 E AndroidRuntime: at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51)
> 01-06 13:43:03.871 7333 7527 E AndroidRuntime: at android.database.CursorWrapper.getString(CursorWrapper.java:137)
> 01-06 13:43:03.871 7333 7527 E AndroidRuntime: at org.apache.cordova.contacts.ContactAccessorSdk5.emailQuery(ContactAccessorSdk5.java:900)
> 01-06 13:43:03.871 7333 7527 E AndroidRuntime: at org.apache.cordova.contacts.ContactAccessorSdk5.populateContactArray(ContactAccessorSdk5.java:428)
> 01-06 13:43:03.871 7333 7527 E AndroidRuntime: at org.apache.cordova.contacts.ContactAccessorSdk5.search(ContactAccessorSdk5.java:287)
> 01-06 13:43:03.871 7333 7527 E AndroidRuntime: at org.apache.cordova.contacts.ContactManager$3.run(ContactManager.java:209)
> 01-06 13:43:03.871 7333 7527 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
> 01-06 13:43:03.871 7333 7527 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
> 01-06 13:43:03.871 7333 7527 E AndroidRuntime: at java.lang.Thread.run(Thread.java:818)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org