You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Joe Bowser (JIRA)" <ji...@apache.org> on 2015/04/17 20:15:59 UTC
[jira] [Resolved] (CB-5278) Contacts.remove : Cursor is not closed.
[ https://issues.apache.org/jira/browse/CB-5278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joe Bowser resolved CB-5278.
----------------------------
Resolution: Fixed
> Contacts.remove : Cursor is not closed.
> ---------------------------------------
>
> Key: CB-5278
> URL: https://issues.apache.org/jira/browse/CB-5278
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 3.1.0
> Environment: Android 4.1.2
> Reporter: Shingo Toda
> Assignee: Joe Bowser
> Priority: Blocker
> Labels: test
>
> When I run Contact mobile-spec tests, I got following warning message.
> {quote}
> 11-05 10:30:32.890: W/CursorWrapperInner(2524): Cursor finalized without prior close()
> {quote}
> I think this is because cursor is not closed at remove(). After close() is added, I don't get this message.
> {code: title=ContactAccessorSdk5.java|borderStyle=solid}
> public boolean remove(String id) {
> int result = 0;
> Cursor cursor = mApp.getActivity().getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,
> null,
> ContactsContract.Contacts._ID + " = ?",
> new String[] { id }, null);
> if (cursor.getCount() == 1) {
> cursor.moveToFirst();
> String lookupKey = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
> Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, lookupKey);
> result = mApp.getActivity().getContentResolver().delete(uri, null, null);
> } else {
> Log.d(LOG_TAG, "Could not find contact with ID");
> }
> //ST Added
> cursor.close();
> return (result > 0) ? true : false;
> }
> {code}
--
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