From bdf8f43628a936b42fa130dd9cc3bbc817357aff Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 30 Mar 2019 18:45:54 +0100 Subject: [PATCH] Workaround Open-Xchange bug --- app/src/main/java/eu/faircode/email/Core.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 63b18927ea..cdb5d1708c 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -813,7 +813,16 @@ class Core { searchTerm = new OrTerm(searchTerm, new FlagTerm(new Flags(Flags.Flag.FLAGGED), true)); long search = SystemClock.elapsedRealtime(); - Message[] imessages = ifolder.search(searchTerm); + Message[] imessages; + try { + imessages = ifolder.search(searchTerm); + } catch (MessagingException ex) { + if (ifolder.getPermanentFlags().contains(Flags.Flag.FLAGGED)) { + Log.w(ex.getMessage()); + imessages = ifolder.search(new ReceivedDateTerm(ComparisonTerm.GE, new Date(sync_time))); + } else + throw ex; + } Log.i(folder.name + " remote count=" + imessages.length + " search=" + (SystemClock.elapsedRealtime() - search) + " ms");