Shingo Toda created CB-5278:
-------------------------------

             Summary: 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
            Priority: Minor


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.1#6144)

Reply via email to