1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-08-13 16:53:51 -04:00

EWS: improve timezone handling

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1579 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-12-12 22:52:04 +00:00
parent 2f47f173d0
commit dded7c6d2e

View File

@ -1546,8 +1546,6 @@ public class EwsExchangeSession extends ExchangeSession {
} }
} }
protected static final String TMZN = "tblTmZn";
protected String getTimezoneidFromOptions() { protected String getTimezoneidFromOptions() {
String result = null; String result = null;
// get user mail URL from html body // get user mail URL from html body
@ -1560,12 +1558,19 @@ public class EwsExchangeSession extends ExchangeSession {
// find email // find email
//noinspection StatementWithEmptyBody //noinspection StatementWithEmptyBody
while ((line = optionsPageReader.readLine()) != null while ((line = optionsPageReader.readLine()) != null
&& (line.indexOf(TMZN) == -1)) { && (line.indexOf("tblTmZn") == -1)
&& (line.indexOf("selTmZn") == -1)) {
} }
if (line != null) { if (line != null) {
int start = line.indexOf("oV=\"") + 4; if (line.indexOf("tblTmZn") >= 0) {
int end = line.indexOf('\"', start); int start = line.indexOf("oV=\"") + 4;
result = line.substring(start, end); int end = line.indexOf('\"', start);
result = line.substring(start, end);
} else {
int end = line.lastIndexOf("\" selected>");
int start = line.lastIndexOf('\"', end - 1);
result = line.substring(start+1, end);
}
} }
} catch (IOException e) { } catch (IOException e) {
LOGGER.error("Error parsing options page at " + optionsMethod.getPath()); LOGGER.error("Error parsing options page at " + optionsMethod.getPath());
@ -1817,7 +1822,12 @@ public class EwsExchangeSession extends ExchangeSession {
String zuluDateValue = null; String zuluDateValue = null;
if (vcalendarDateValue != null) { if (vcalendarDateValue != null) {
try { try {
SimpleDateFormat dateParser = new SimpleDateFormat("yyyyMMdd'T'HHmmss", Locale.ENGLISH); SimpleDateFormat dateParser;
if (vcalendarDateValue.length() == 8) {
dateParser = new SimpleDateFormat("yyyyMMdd", Locale.ENGLISH);
} else {
dateParser = new SimpleDateFormat("yyyyMMdd'T'HHmmss", Locale.ENGLISH);
}
dateParser.setTimeZone(GMT_TIMEZONE); dateParser.setTimeZone(GMT_TIMEZONE);
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH); SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH);
dateFormatter.setTimeZone(GMT_TIMEZONE); dateFormatter.setTimeZone(GMT_TIMEZONE);