From 85ff07a00a368beb1da4090de6fb086c3fad972e Mon Sep 17 00:00:00 2001 From: Martin Hibdon Date: Wed, 11 Sep 2013 16:59:55 -0700 Subject: [PATCH] Fix a bug in Pop3 sync b/10413188 There are still several issues with attachments generally, but this fixes the most glaring problem: We were short circuiting in a loop that needed to populate a hash table of remote message Ids, so not all of them would be present. The later code intended to load attachments expected it to be fully populated. There are still several problems, notably that if downloading doesn't work, it just spins forever, but this fixes the first problem. Change-Id: I2b23dcb841edabe108096933fea2350ef61a10f1 --- src/com/android/email/service/Pop3Service.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/com/android/email/service/Pop3Service.java b/src/com/android/email/service/Pop3Service.java index 4fdacfb71..87dbeefa7 100644 --- a/src/com/android/email/service/Pop3Service.java +++ b/src/com/android/email/service/Pop3Service.java @@ -333,8 +333,8 @@ public class Pop3Service extends Service { * older messages. * 3. We have some local messages, but after examining the most recent * DEFAULT_SYNC_COUNT remote messages, we still have not encountered any that exist - * locally. In this case, we'll abort, leaving a gap between the ones we've just loaded - * and the ones we already had. + * locally. In this case, we'll stop adding new messages to sync, leaving a gap between + * the ones we've just loaded and the ones we already had. * 4. We examine all of the remote messages before running into any of our count * limitations. */ @@ -353,6 +353,10 @@ public class Pop3Service extends Service { for (final Pop3Message message : remoteMessages) { final String uid = message.getUid(); remoteUidMap.put(uid, message); + } + + for (final Pop3Message message : remoteMessages) { + final String uid = message.getUid(); final LocalMessageInfo localMessage = localMessageMap.get(uid); if (localMessage == null) { @@ -381,7 +385,6 @@ public class Pop3Service extends Service { LogUtils.d(Logging.LOG_TAG, "loaded " + count + " messages, stopping"); break; } - } } else { if (MailActivityEmail.DEBUG) {