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)},
null);
if ((updatesCursor == null) || (updatesCursor.getCount() == 0)) return;
ArrayList<Long> mailboxesToUpdate = new ArrayList<Long>();
while (updatesCursor.moveToNext()) {
Long mailboxId = updatesCursor.getLong(0);
if (!mailboxesToUpdate.contains(mailboxId)) {
mailboxesToUpdate.add(mailboxId);
ArrayList<Long> mailboxesToUpdate;
try {
mailboxesToUpdate = new ArrayList<Long>();
while (updatesCursor.moveToNext()) {
Long mailboxId = updatesCursor.getLong(0);
if (!mailboxesToUpdate.contains(mailboxId)) {
mailboxesToUpdate.add(mailboxId);
}
}
} finally {
updatesCursor.close();
}
for (long mailboxId: mailboxesToUpdate) {
sync(context, mailboxId, syncResult, false);