diff --git a/k9mail/src/main/java/com/fsck/k9/account/AccountCreator.java b/k9mail/src/main/java/com/fsck/k9/account/AccountCreator.java index fddb456a8..6a8f9ead7 100644 --- a/k9mail/src/main/java/com/fsck/k9/account/AccountCreator.java +++ b/k9mail/src/main/java/com/fsck/k9/account/AccountCreator.java @@ -5,9 +5,6 @@ import com.fsck.k9.Account.DeletePolicy; import com.fsck.k9.mail.ConnectionSecurity; import com.fsck.k9.mail.ServerSettings.Type; -import java.util.HashMap; -import java.util.Map; - /** * Deals with logic surrounding account creation. @@ -16,16 +13,23 @@ import java.util.Map; */ public class AccountCreator { - private static Map defaults = new HashMap(); - - static { - defaults.put(Type.IMAP, DeletePolicy.ON_DELETE); - defaults.put(Type.POP3, DeletePolicy.NEVER); - defaults.put(Type.WebDAV, DeletePolicy.ON_DELETE); - } - public static DeletePolicy calculateDefaultDeletePolicy(Type type) { - return defaults.get(type); + switch (type) { + case IMAP: { + return DeletePolicy.ON_DELETE; + } + case POP3: { + return DeletePolicy.NEVER; + } + case WebDAV: { + return DeletePolicy.ON_DELETE; + } + case SMTP: { + throw new IllegalStateException("Delete policy doesn't apply to SMTP"); + } + } + + throw new AssertionError("Unhandled case: " + type); } public static int getDefaultPort(ConnectionSecurity securityType, Type storeType) {