From 35c79a5656ba0224d0b75c190630be82cf6a64a1 Mon Sep 17 00:00:00 2001 From: Koji Arai Date: Wed, 26 Jun 2013 23:57:55 +0900 Subject: [PATCH 1/2] adapt broken pop3 server --- src/com/fsck/k9/mail/store/Pop3Store.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/fsck/k9/mail/store/Pop3Store.java b/src/com/fsck/k9/mail/store/Pop3Store.java index 53a188ee7..44440e4cf 100644 --- a/src/com/fsck/k9/mail/store/Pop3Store.java +++ b/src/com/fsck/k9/mail/store/Pop3Store.java @@ -642,7 +642,7 @@ public class Pop3Store extends Store { if (response.equals(".")) { break; } - String[] uidParts = response.split(" "); + String[] uidParts = response.split(" +"); // Ignore messages without a unique-id if (uidParts.length >= 2) { From b88fbb7fd8910194d751506f034b44ab556f9a6d Mon Sep 17 00:00:00 2001 From: Koji Arai Date: Sat, 29 Jun 2013 22:28:27 +0900 Subject: [PATCH 2/2] adapt to a corner case for broken server. --- src/com/fsck/k9/mail/store/Pop3Store.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/fsck/k9/mail/store/Pop3Store.java b/src/com/fsck/k9/mail/store/Pop3Store.java index 44440e4cf..f809e0955 100644 --- a/src/com/fsck/k9/mail/store/Pop3Store.java +++ b/src/com/fsck/k9/mail/store/Pop3Store.java @@ -567,8 +567,13 @@ public class Pop3Store extends Store { Pop3Message message = mMsgNumToMsgMap.get(msgNum); if (message == null) { String response = executeSimpleCommand(UIDL_COMMAND + " " + msgNum); - int uidIndex = response.lastIndexOf(' '); - String msgUid = response.substring(uidIndex + 1); + // response = "+OK msgNum msgUid" + String[] uidParts = response.split(" +"); + if (uidParts.length < 3 || !"+OK".equals(uidParts[0])) { + Log.e(K9.LOG_TAG, "ERR response: " + response); + return; + } + String msgUid = uidParts[2]; message = new Pop3Message(msgUid, this); indexMessage(msgNum, message); }