Messaging: Use try-with-resource

Change-Id: I6649517cbd990502dfcb54f078764cf05f210268
This commit is contained in:
Michael W
2024-12-26 15:54:37 +01:00
parent 2a09fa3cb9
commit 9538179c75
24 changed files with 199 additions and 455 deletions
@@ -166,7 +166,7 @@ public final class ContactRecipientAdapter extends BaseRecipientAdapter {
cursorResult.enterpriseCursor};
for (Cursor cursor : cursors) {
if (cursor != null) {
try {
try (cursor) {
final List<RecipientEntry> tempEntries = new ArrayList<>();
HashSet<Long> existingContactIds = new HashSet<>();
while (cursor.moveToNext()) {
@@ -185,8 +185,6 @@ public final class ContactRecipientAdapter extends BaseRecipientAdapter {
Collections.sort(tempEntries, mComparator);
}
entries.addAll(tempEntries);
} finally {
cursor.close();
}
}
}