From c283449d04e9c38f4970beaf2d25638c681b5a6d Mon Sep 17 00:00:00 2001 From: Sander Bogaert Date: Tue, 12 Apr 2011 14:32:42 +0200 Subject: [PATCH] Added another badDateTimeFormat to ImapResponseParser. Some IMAP servers generate timestamps without timezones. :/ Fixes gcode issue 3179 --- src/com/fsck/k9/mail/store/ImapResponseParser.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/com/fsck/k9/mail/store/ImapResponseParser.java b/src/com/fsck/k9/mail/store/ImapResponseParser.java index f52653da0a..090dd85ad9 100644 --- a/src/com/fsck/k9/mail/store/ImapResponseParser.java +++ b/src/com/fsck/k9/mail/store/ImapResponseParser.java @@ -15,6 +15,7 @@ public class ImapResponseParser { private static final SimpleDateFormat mDateTimeFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss Z", Locale.US); private static final SimpleDateFormat badDateTimeFormat = new SimpleDateFormat("dd MMM yyyy HH:mm:ss Z", Locale.US); private static final SimpleDateFormat badDateTimeFormat2 = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z", Locale.US); + private static final SimpleDateFormat badDateTimeFormat3 = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss", Locale.US); private PeekableInputStream mIn; private ImapResponse mResponse; @@ -426,8 +427,14 @@ public class ImapResponseParser { return badDateTimeFormat.parse(value); } } catch (Exception e2) { - synchronized (badDateTimeFormat2) { - return badDateTimeFormat2.parse(value); + try { + synchronized (badDateTimeFormat2) { + return badDateTimeFormat2.parse(value); + } + } catch (Exception e3) { + synchronized (badDateTimeFormat3) { + return badDateTimeFormat3.parse(value); + } } } } -- GitLab