Close cursor

Change-Id: I6c983c921f9b27f1d69e603d96e57d285a53750a
This commit is contained in:
Marc Blank 2012-04-05 11:48:43 -07:00
parent 385460b6f0
commit fcc9c80af5

View File

@ -160,12 +160,17 @@ public class PopImapSyncAdapterService extends Service {
new String[] {Long.toString(acct.mId)}, new String[] {Long.toString(acct.mId)},
null); null);
if ((updatesCursor == null) || (updatesCursor.getCount() == 0)) return; if ((updatesCursor == null) || (updatesCursor.getCount() == 0)) return;
ArrayList<Long> mailboxesToUpdate = new ArrayList<Long>(); ArrayList<Long> mailboxesToUpdate;
while (updatesCursor.moveToNext()) { try {
Long mailboxId = updatesCursor.getLong(0); mailboxesToUpdate = new ArrayList<Long>();
if (!mailboxesToUpdate.contains(mailboxId)) { while (updatesCursor.moveToNext()) {
mailboxesToUpdate.add(mailboxId); Long mailboxId = updatesCursor.getLong(0);
if (!mailboxesToUpdate.contains(mailboxId)) {
mailboxesToUpdate.add(mailboxId);
}
} }
} finally {
updatesCursor.close();
} }
for (long mailboxId: mailboxesToUpdate) { for (long mailboxId: mailboxesToUpdate) {
sync(context, mailboxId, syncResult, false); sync(context, mailboxId, syncResult, false);