From 268ccfc0ff3112dd534c06fb4abfca96df16855d Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Sat, 1 Dec 2018 14:02:48 +0100 Subject: [PATCH] Stop ImapFolderPusher on CertificateValidationException This is a permanent error, but apparently not treated as one. I got a certificate error notification every two seconds just now (because LocalKeyStore is broken, see #3772). This PR simply stops the pusher on a certificate error. --- .../java/com/fsck/k9/mail/store/imap/ImapFolderPusher.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/ImapFolderPusher.java b/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/ImapFolderPusher.java index be74979e2d7..6621489b054 100644 --- a/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/ImapFolderPusher.java +++ b/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/ImapFolderPusher.java @@ -12,6 +12,7 @@ import java.util.Set; import com.fsck.k9.mail.AuthenticationFailedException; +import com.fsck.k9.mail.CertificateValidationException; import com.fsck.k9.mail.Flag; import com.fsck.k9.mail.K9MailLib; import com.fsck.k9.mail.Message; @@ -194,6 +195,12 @@ public void run() { pushReceiver.authenticationFailed(); stop = true; + } catch (CertificateValidationException e) { + reacquireWakeLockAndCleanUp(); + + Timber.e(e, "Certificate check failed. Stopping ImapFolderPusher."); + stop = true; + pushReceiver.pushError("Push error for " + getServerId(), e); } catch (Exception e) { reacquireWakeLockAndCleanUp();