From coverity: synchronize HttpClient cookies access

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2263 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2014-03-17 23:43:55 +00:00
parent 93515d8ddb
commit 61dcfae33f
2 changed files with 62 additions and 58 deletions

View File

@ -3294,6 +3294,7 @@ public abstract class ExchangeSession {
static final String MAILBOX_BASE = "/cn=";
protected void getEmailAndAliasFromOptions() {
synchronized (httpClient.getState()) {
Cookie[] currentCookies = httpClient.getState().getCookies();
// get user mail URL from html body
BufferedReader optionsPageReader = null;
@ -3304,11 +3305,12 @@ public abstract class ExchangeSession {
String line;
// find email and alias
//noinspection StatementWithEmptyBody
while ((line = optionsPageReader.readLine()) != null
&& (line.indexOf('[') == -1
|| line.indexOf('@') == -1
|| line.indexOf(']') == -1)
&& line.toLowerCase().indexOf(MAILBOX_BASE) == -1) {
&& !line.toLowerCase().contains(MAILBOX_BASE)) {
}
if (line != null) {
int start = line.toLowerCase().lastIndexOf(MAILBOX_BASE) + MAILBOX_BASE.length();
@ -3333,6 +3335,7 @@ public abstract class ExchangeSession {
optionsMethod.releaseConnection();
}
}
}
/**
* Get current user email

View File

@ -752,7 +752,7 @@ public class DavExchangeSession extends ExchangeSession {
}
protected void checkPublicFolder() {
synchronized (httpClient.getState()) {
Cookie[] currentCookies = httpClient.getState().getCookies();
// check public folder access
try {
@ -779,6 +779,7 @@ public class DavExchangeSession extends ExchangeSession {
publicFolderUrl = PUBLIC_ROOT;
}
}
}
protected void getWellKnownFolders() throws DavMailException {
// Retrieve well known URLs