mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-24 08:38:51 -05:00
Unify two IMAP date parsing paths, improving the exception so we can
learn what date format we don't cope with.
This commit is contained in:
parent
65c6fe592e
commit
39e3aecf73
@ -347,13 +347,25 @@ public class ImapResponseParser {
|
||||
}
|
||||
|
||||
public Date getDate(int index) throws MessagingException {
|
||||
return getDate(getString(index));
|
||||
}
|
||||
|
||||
public Date getKeyedDate(Object key) throws MessagingException {
|
||||
return getDate(getKeyedString(key));
|
||||
}
|
||||
|
||||
private Date getDate(String value) throws MessagingException {
|
||||
try {
|
||||
return parseDate(getString(index));
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
return parseDate(value);
|
||||
} catch (ParseException pe) {
|
||||
throw new MessagingException("Unable to parse IMAP datetime", pe);
|
||||
throw new MessagingException("Unable to parse IMAP datetime '"+value+"' ", pe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Object getKeyedValue(Object key) {
|
||||
for (int i = 0, count = size(); i < count; i++) {
|
||||
if (equalsIgnoreCase(get(i), key)) {
|
||||
@ -379,18 +391,6 @@ public class ImapResponseParser {
|
||||
return Integer.parseInt(getKeyedString(key));
|
||||
}
|
||||
|
||||
public Date getKeyedDate(Object key) throws MessagingException {
|
||||
try {
|
||||
String value = getKeyedString(key);
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
return parseDate(value);
|
||||
} catch (ParseException pe) {
|
||||
throw new MessagingException("Unable to parse IMAP datetime", pe);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean containsKey(Object key) {
|
||||
if (key == null) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user