From 1a5e963c1b8956a2c894319b2ded805e7b96ee34 Mon Sep 17 00:00:00 2001 From: mguessan Date: Mon, 12 Jul 2010 12:43:42 +0000 Subject: [PATCH] DAV: another datereceived fix git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1174 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/exchange/dav/DavExchangeSession.java | 2 +- .../davmail/exchange/TestExchangeSessionMessageFlags.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/java/davmail/exchange/dav/DavExchangeSession.java b/src/java/davmail/exchange/dav/DavExchangeSession.java index 4942a567..c6c73f18 100644 --- a/src/java/davmail/exchange/dav/DavExchangeSession.java +++ b/src/java/davmail/exchange/dav/DavExchangeSession.java @@ -572,7 +572,7 @@ public class DavExchangeSession extends ExchangeSession { for (String attributeName : CONTACT_ATTRIBUTES) { String value = getPropertyIfExists(properties, attributeName); if (value != null) { - if ("bday".equals(attributeName) || "lastmodified".equals(attributeName)) { + if ("bday".equals(attributeName) || "lastmodified".equals(attributeName) || "datereceived".equals(attributeName)) { value = convertDate(value); } put(attributeName, value); diff --git a/src/test/davmail/exchange/TestExchangeSessionMessageFlags.java b/src/test/davmail/exchange/TestExchangeSessionMessageFlags.java index 0138fa5f..6991a9f7 100644 --- a/src/test/davmail/exchange/TestExchangeSessionMessageFlags.java +++ b/src/test/davmail/exchange/TestExchangeSessionMessageFlags.java @@ -98,7 +98,7 @@ public class TestExchangeSessionMessageFlags extends AbstractExchangeSessionTest MimeMessage mimeMessage = createMimeMessage(); String messageName = UUID.randomUUID().toString(); HashMap properties = new HashMap(); - SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + SimpleDateFormat dateFormatter = ExchangeSession.getExchangeZuluDateFormat(); dateFormatter.setTimeZone(ExchangeSession.GMT_TIMEZONE); Calendar cal = Calendar.getInstance(); cal.add(Calendar.MONTH, -1); @@ -108,7 +108,8 @@ public class TestExchangeSessionMessageFlags extends AbstractExchangeSessionTest assertNotNull(messageList); assertEquals(1, messageList.size()); assertNotNull(messageList); - assertEquals(properties.get("datereceived"), messageList.get(0).date); + // TODO: use same format for date read/write + assertEquals(ExchangeSession.getZuluDateFormat().format(cal.getTime()), messageList.get(0).date); }