diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index e1af45a78..b88d84f76 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -191,8 +191,14 @@ public class ImapStore extends Store { if (imapUri.getUserInfo() != null) { try { - String[] userInfoParts = imapUri.getUserInfo().split(":"); - if (userInfoParts.length == 2) { + String userinfo = imapUri.getUserInfo(); + String[] userInfoParts = userinfo.split(":"); + + if (userinfo.endsWith(":")) { + // Password is empty. This can only happen after an account was imported. + authenticationType = AuthType.valueOf(userInfoParts[0]).name(); + username = URLDecoder.decode(userInfoParts[1], "UTF-8"); + } else if (userInfoParts.length == 2) { authenticationType = AuthType.PLAIN.name(); username = URLDecoder.decode(userInfoParts[0], "UTF-8"); password = URLDecoder.decode(userInfoParts[1], "UTF-8"); diff --git a/src/com/fsck/k9/mail/store/Pop3Store.java b/src/com/fsck/k9/mail/store/Pop3Store.java index 8144124fc..4b11cdf83 100644 --- a/src/com/fsck/k9/mail/store/Pop3Store.java +++ b/src/com/fsck/k9/mail/store/Pop3Store.java @@ -115,8 +115,11 @@ public class Pop3Store extends Store { if (pop3Uri.getUserInfo() != null) { try { int userIndex = 0, passwordIndex = 1; - String[] userInfoParts = pop3Uri.getUserInfo().split(":"); - if (userInfoParts.length > 2) { + String userinfo = pop3Uri.getUserInfo(); + String[] userInfoParts = userinfo.split(":"); + if (userInfoParts.length > 2 || userinfo.endsWith(":") ) { + // If 'userinfo' ends with ":" the password is empty. This can only happen + // after an account was imported (so authType and username are present). userIndex++; passwordIndex++; authType = userInfoParts[0];