Caldav: fix regression in FreeBusy date handling

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@515 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-04-11 12:27:10 +00:00
parent a1c8caa04b
commit d70390a77b
2 changed files with 12 additions and 12 deletions

View File

@ -265,7 +265,7 @@ public class CaldavConnection extends AbstractConnection {
int size = events.size(); int size = events.size();
int count = 0; int count = 0;
for (ExchangeSession.Event event : events) { for (ExchangeSession.Event event : events) {
DavGatewayTray.debug("Retrieving event " + (++count) + "/" + size); DavGatewayTray.debug("Listing event " + (++count) + "/" + size);
DavGatewayTray.switchIcon(); DavGatewayTray.switchIcon();
appendEventResponse(response, request, path, event); appendEventResponse(response, request, path, event);
} }

View File

@ -120,7 +120,8 @@ public class ExchangeSession {
private boolean disableGalLookup = false; private boolean disableGalLookup = false;
private static final String YYYY_MM_DD_HH_MM_SS = "yyyy/MM/dd HH:mm:ss"; private static final String YYYY_MM_DD_HH_MM_SS = "yyyy/MM/dd HH:mm:ss";
private static final String YYYY_MMDD_T_HHMMSS_Z = "yyyyMMdd'T'HHmmss'Z'"; private static final String YYYYMMDD_T_HHMMSS_Z = "yyyyMMdd'T'HHmmss'Z'";
private static final String YYYY_MM_DD_T_HHMMSS_Z = "yyyy-MM-dd'T'HH:mm:ss'Z'";
/** /**
* Create an exchange session for the given URL. * Create an exchange session for the given URL.
@ -208,17 +209,15 @@ public class ExchangeSession {
} }
protected SimpleDateFormat getZuluDateFormat() { protected SimpleDateFormat getZuluDateFormat() {
SimpleDateFormat dateFormat = new SimpleDateFormat(YYYY_MMDD_T_HHMMSS_Z, Locale.ENGLISH); SimpleDateFormat dateFormat = new SimpleDateFormat(YYYYMMDD_T_HHMMSS_Z, Locale.ENGLISH);
dateFormat.setTimeZone(GMT_TIMEZONE); dateFormat.setTimeZone(GMT_TIMEZONE);
return dateFormat; return dateFormat;
} }
protected String formatZuluDate(Date date) { protected SimpleDateFormat getExchangeZuluDateFormat() {
return getZuluDateFormat().format(date); SimpleDateFormat dateFormat = new SimpleDateFormat(YYYY_MM_DD_T_HHMMSS_Z, Locale.ENGLISH);
} dateFormat.setTimeZone(GMT_TIMEZONE);
return dateFormat;
protected Date parseZuluDate(String dateString) throws ParseException {
return getZuluDateFormat().parse(dateString);
} }
protected Date parseDate(String dateString) throws ParseException { protected Date parseDate(String dateString) throws ParseException {
@ -1566,7 +1565,7 @@ public class ExchangeSession {
} }
if (icsBody.indexOf("X-MICROSOFT-CDO-REPLYTIME") < 0) { if (icsBody.indexOf("X-MICROSOFT-CDO-REPLYTIME") < 0) {
icsBody = icsBody.replaceAll("END:VEVENT", "X-MICROSOFT-CDO-REPLYTIME:" + icsBody = icsBody.replaceAll("END:VEVENT", "X-MICROSOFT-CDO-REPLYTIME:" +
formatZuluDate(new Date()) + "\r\nEND:VEVENT"); getZuluDateFormat().format(new Date()) + "\r\nEND:VEVENT");
} }
} }
} }
@ -1922,6 +1921,7 @@ public class ExchangeSession {
attendee = attendee.substring("mailto:".length()); attendee = attendee.substring("mailto:".length());
} }
SimpleDateFormat exchangeZuluDateFormat = getExchangeZuluDateFormat();
SimpleDateFormat icalDateFormat = getZuluDateFormat(); SimpleDateFormat icalDateFormat = getZuluDateFormat();
String url; String url;
@ -1939,8 +1939,8 @@ public class ExchangeSession {
endDate = icalDateFormat.parse(endDateValue); endDate = icalDateFormat.parse(endDateValue);
} }
url = "/public/?cmd=freebusy" + url = "/public/?cmd=freebusy" +
"&start=" + icalDateFormat.format(startDate) + "&start=" + exchangeZuluDateFormat.format(startDate) +
"&end=" + icalDateFormat.format(endDate) + "&end=" + exchangeZuluDateFormat.format(endDate) +
"&interval=" + FREE_BUSY_INTERVAL + "&interval=" + FREE_BUSY_INTERVAL +
"&u=SMTP:" + attendee; "&u=SMTP:" + attendee;
} catch (ParseException e) { } catch (ParseException e) {