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
1 changed files with 9 additions and 2 deletions

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,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);
}
}
}
}