diff options
author | Scott Kennedy <skennedy@google.com> | 2013-03-14 23:22:11 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-03-14 23:22:11 +0000 |
commit | e35b1406916bef5623cead8c02e6d8466bb6e968 (patch) | |
tree | 35359c17def19780793c7b2952f9a93318cfddd6 /chips | |
parent | 5727eeebd6f7afc15b773dd851a121f51a4ccd75 (diff) | |
parent | e46cb66d4265b6fb8800f9120086151b36011f0f (diff) | |
download | android_frameworks_ex-e35b1406916bef5623cead8c02e6d8466bb6e968.tar.gz android_frameworks_ex-e35b1406916bef5623cead8c02e6d8466bb6e968.tar.bz2 android_frameworks_ex-e35b1406916bef5623cead8c02e6d8466bb6e968.zip |
am e46cb66d: Always close this cursor
* commit 'e46cb66d4265b6fb8800f9120086151b36011f0f':
Always close this cursor
Diffstat (limited to 'chips')
-rw-r--r-- | chips/src/com/android/ex/chips/RecipientAlternatesAdapter.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/chips/src/com/android/ex/chips/RecipientAlternatesAdapter.java b/chips/src/com/android/ex/chips/RecipientAlternatesAdapter.java index 465c90e..0693df2 100644 --- a/chips/src/com/android/ex/chips/RecipientAlternatesAdapter.java +++ b/chips/src/com/android/ex/chips/RecipientAlternatesAdapter.java @@ -136,10 +136,17 @@ public class RecipientAlternatesAdapter extends CursorAdapter { final Set<String> matchesNotFound = new HashSet<String>(); if (recipientEntries.size() < addresses.size()) { final List<DirectorySearchParams> paramsList; - Cursor directoryCursor = context.getContentResolver().query(DirectoryListQuery.URI, - DirectoryListQuery.PROJECTION, null, null, null); - paramsList = BaseRecipientAdapter.setupOtherDirectories(context, directoryCursor, - account); + Cursor directoryCursor = null; + try { + directoryCursor = context.getContentResolver().query(DirectoryListQuery.URI, + DirectoryListQuery.PROJECTION, null, null, null); + paramsList = BaseRecipientAdapter.setupOtherDirectories(context, directoryCursor, + account); + } finally { + if (directoryCursor != null) { + directoryCursor.close(); + } + } // Run a directory query for each unmatched recipient. HashSet<String> unresolvedAddresses = new HashSet<String>(); for (String address : addresses) { |