From 284fe9bce0426616bc06b4d2937fc5d6b3a423b9 Mon Sep 17 00:00:00 2001 From: mguessan Date: Wed, 17 Jul 2013 22:11:30 +0000 Subject: [PATCH] Fix NullPointerException on server unavailable git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2156 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/exchange/ExchangeSession.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java index 9cefabe5..7bad0bab 100644 --- a/src/java/davmail/exchange/ExchangeSession.java +++ b/src/java/davmail/exchange/ExchangeSession.java @@ -530,15 +530,15 @@ public abstract class ExchangeSession { // try to get new method from script based redirection logonMethod = buildLogonMethod(httpClient, logonMethod); - if (otpPreAuthFound && otpPreAuthRetries < MAX_OTP_RETRIES) { - // A OTP pre-auth page has been found, it is needed to restart the login process. - // This applies to both the case the user entered a good OTP code (the usual login process - // takes place) and the case the user entered a wrong OTP code (another code will be asked to him). - // The user has up to MAX_OTP_RETRIES chances to input a valid OTP key. - return postLogonMethod(httpClient, logonMethod, userName, password); - } - if (logonMethod != null) { + if (otpPreAuthFound && otpPreAuthRetries < MAX_OTP_RETRIES) { + // A OTP pre-auth page has been found, it is needed to restart the login process. + // This applies to both the case the user entered a good OTP code (the usual login process + // takes place) and the case the user entered a wrong OTP code (another code will be asked to him). + // The user has up to MAX_OTP_RETRIES chances to input a valid OTP key. + return postLogonMethod(httpClient, logonMethod, userName, password); + } + // if logonMethod is not null, try to follow redirection logonMethod = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, logonMethod); checkFormLoginQueryString(logonMethod);