am e46cb66d: Always close this cursor
* commit 'e46cb66d4265b6fb8800f9120086151b36011f0f':
Always close this cursor
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 @@
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) {