From 3ffab25635defe03973ffedaae9f2b322ab50446 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Sat, 23 Apr 2022 00:21:23 +0200 Subject: [PATCH] now resetting imap errors after successfull job --- pom.xml | 2 +- .../java/de/srsoftware/widerhall/data/MailingList.java | 9 +++++++++ .../java/de/srsoftware/widerhall/mail/ImapClient.java | 1 + .../de/srsoftware/widerhall/mail/ProblemListener.java | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4633c5e..69c974c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.example Widerhall - 0.2.26 + 0.2.27 diff --git a/src/main/java/de/srsoftware/widerhall/data/MailingList.java b/src/main/java/de/srsoftware/widerhall/data/MailingList.java index ada0285..5d3fcd0 100644 --- a/src/main/java/de/srsoftware/widerhall/data/MailingList.java +++ b/src/main/java/de/srsoftware/widerhall/data/MailingList.java @@ -93,6 +93,15 @@ public class MailingList implements MessageHandler, ProblemListener { return setFlag(STATE_PUBLIC_ARCHIVE,enabled); } + @Override + public void clearProblems() { + try { + setLastError(null); + } catch (SQLException e) { + LOG.warn("setLastError(null) failed."); + } + } + /** * create a new ML object int the database * @param email diff --git a/src/main/java/de/srsoftware/widerhall/mail/ImapClient.java b/src/main/java/de/srsoftware/widerhall/mail/ImapClient.java index 2629ca6..59e0383 100644 --- a/src/main/java/de/srsoftware/widerhall/mail/ImapClient.java +++ b/src/main/java/de/srsoftware/widerhall/mail/ImapClient.java @@ -65,6 +65,7 @@ public class ImapClient { while (!stopped){ handleMessages(); + problemListener.clearProblems(); LOG.debug("Idling."); inbox.idle(true); } diff --git a/src/main/java/de/srsoftware/widerhall/mail/ProblemListener.java b/src/main/java/de/srsoftware/widerhall/mail/ProblemListener.java index b22d747..bf7d260 100644 --- a/src/main/java/de/srsoftware/widerhall/mail/ProblemListener.java +++ b/src/main/java/de/srsoftware/widerhall/mail/ProblemListener.java @@ -4,4 +4,6 @@ import javax.mail.MessagingException; public interface ProblemListener { public void onImapException(MessagingException e); + + public void clearProblems(); }