1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Added another badDateTimeFormat to ImapResponseParser.

Some IMAP servers generate timestamps without timezones. :/

Fixes gcode issue 3179
This commit is contained in:
Sander Bogaert 2011-04-12 14:32:42 +02:00 committed by Jesse Vincent
parent 939660faf4
commit c283449d04

View File

@ -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,9 +427,15 @@ public class ImapResponseParser {
return badDateTimeFormat.parse(value);
}
} catch (Exception e2) {
try {
synchronized (badDateTimeFormat2) {
return badDateTimeFormat2.parse(value);
}
} catch (Exception e3) {
synchronized (badDateTimeFormat3) {
return badDateTimeFormat3.parse(value);
}
}
}
}
}