mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 03:02:22 -05:00
Restore cookies on error
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1459 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
c767c2276f
commit
8a49d74078
@ -2716,6 +2716,7 @@ public abstract class ExchangeSession {
|
||||
static final String MAILBOX_BASE = "/cn=";
|
||||
|
||||
protected void getEmailAndAliasFromOptions() {
|
||||
Cookie[] currentCookies = httpClient.getState().getCookies();
|
||||
// get user mail URL from html body
|
||||
BufferedReader optionsPageReader = null;
|
||||
GetMethod optionsMethod = new GetMethod("/owa/?ae=Options&t=About");
|
||||
@ -2741,6 +2742,8 @@ public abstract class ExchangeSession {
|
||||
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// restore cookies on error
|
||||
httpClient.getState().addCookies(currentCookies);
|
||||
LOGGER.error("Error parsing options page at " + optionsMethod.getPath());
|
||||
} finally {
|
||||
if (optionsPageReader != null) {
|
||||
@ -2752,7 +2755,6 @@ public abstract class ExchangeSession {
|
||||
}
|
||||
optionsMethod.releaseConnection();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -688,6 +688,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
// default public folder path
|
||||
publicFolderUrl = PUBLIC_ROOT;
|
||||
|
||||
Cookie[] currentCookies = httpClient.getState().getCookies();
|
||||
// check public folder access
|
||||
try {
|
||||
if (inboxUrl != null) {
|
||||
@ -711,6 +712,8 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
// update public folder URI
|
||||
publicFolderUrl = propFindMethod.getURI().getURI();
|
||||
} catch (IOException e) {
|
||||
// restore cookies on error
|
||||
httpClient.getState().addCookies(currentCookies);
|
||||
LOGGER.warn("Public folders not available: " + (e.getMessage() == null ? e : e.getMessage()));
|
||||
publicFolderUrl = "/public";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user