EWS: allow autodiscover after authentication failure

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1540 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-11-09 22:36:10 +00:00
parent 1b2c7c720c
commit e8a7e0b750
1 changed files with 4 additions and 2 deletions

View File

@ -148,13 +148,15 @@ public class EwsExchangeSession extends ExchangeSession {
// check EWS access
try {
checkEndPointUrl("/ews/exchange.asmx");
} catch (DavMailAuthenticationException e) {
throw e;
} catch (IOException e) {
try {
// failover, try to retrieve EWS url from autodiscover
checkEndPointUrl(getEwsUrlFromAutoDiscover());
} catch (IOException e2) {
// autodiscover failed and initial exception was authentication failure => throw original exception
if (e instanceof DavMailAuthenticationException) {
throw (DavMailAuthenticationException)e;
}
LOGGER.error(e2.getMessage());
throw new DavMailAuthenticationException("EXCEPTION_EWS_NOT_AVAILABLE");
}