mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 09:21:49 -05:00
IMAP: fix search date format for Exchange 2010 support (ErrorInvalidValueForProperty)
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1917 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
67766c818f
commit
97c38dc96b
@ -1297,8 +1297,6 @@ public class ImapConnection extends AbstractConnection {
|
||||
Date endDate;
|
||||
SimpleDateFormat parser = new SimpleDateFormat("dd-MMM-yyyy", Locale.ENGLISH);
|
||||
parser.setTimeZone(ExchangeSession.GMT_TIMEZONE);
|
||||
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
||||
dateFormatter.setTimeZone(ExchangeSession.GMT_TIMEZONE);
|
||||
String dateToken = tokens.nextToken();
|
||||
try {
|
||||
startDate = parser.parse(dateToken);
|
||||
@ -1317,12 +1315,12 @@ public class ImapConnection extends AbstractConnection {
|
||||
}
|
||||
|
||||
if (token.endsWith("ON")) {
|
||||
return session.and(session.gt(searchAttribute, dateFormatter.format(startDate)),
|
||||
session.lt(searchAttribute, dateFormatter.format(endDate)));
|
||||
return session.and(session.gt(searchAttribute, session.formatSearchDate(startDate)),
|
||||
session.lt(searchAttribute, session.formatSearchDate(endDate)));
|
||||
} else if (token.endsWith("BEFORE")) {
|
||||
return session.lt(searchAttribute, dateFormatter.format(startDate));
|
||||
return session.lt(searchAttribute, session.formatSearchDate(startDate));
|
||||
} else if (token.endsWith("SINCE")) {
|
||||
return session.gte(searchAttribute, dateFormatter.format(startDate));
|
||||
return session.gte(searchAttribute, session.formatSearchDate(startDate));
|
||||
} else {
|
||||
throw new DavMailException("EXCEPTION_INVALID_SEARCH_PARAMETERS", dateToken);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user