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:
parent
93515d8ddb
commit
61dcfae33f
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -1099,7 +1100,7 @@ public class DavExchangeSession extends ExchangeSession {
|
|||
// workaround for messages in Sent folder
|
||||
if (!messageHeaders.contains("From:")) {
|
||||
String from = getItemProperty(permanentUrl, "from");
|
||||
messageHeaders = "From: "+from+ '\n' +messageHeaders;
|
||||
messageHeaders = "From: " + from + '\n' + messageHeaders;
|
||||
}
|
||||
result = new ByteArrayInputStream(messageHeaders.getBytes("UTF-8"));
|
||||
}
|
||||
|
@ -1358,7 +1359,7 @@ public class DavExchangeSession extends ExchangeSession {
|
|||
@Override
|
||||
public byte[] getEventContent() throws IOException {
|
||||
byte[] result = null;
|
||||
LOGGER.debug("Get event subject: " + subject + " contentclass: "+contentClass+" href: " + getHref() + " permanentUrl: " + permanentUrl);
|
||||
LOGGER.debug("Get event subject: " + subject + " contentclass: " + contentClass + " href: " + getHref() + " permanentUrl: " + permanentUrl);
|
||||
// do not try to load tasks MIME body
|
||||
if (!"urn:content-classes:task".equals(contentClass)) {
|
||||
// try to get PR_INTERNET_CONTENT
|
||||
|
@ -1706,7 +1707,7 @@ public class DavExchangeSession extends ExchangeSession {
|
|||
// Set contentclass to make ActiveSync happy
|
||||
propertyList.add(Field.createDavProperty("contentclass", contentClass));
|
||||
// ... but also set PR_INTERNET_CONTENT to preserve custom properties
|
||||
propertyList.add(Field.createDavProperty("internetContent",IOUtil.encodeBase64AsString(mimeContent)));
|
||||
propertyList.add(Field.createDavProperty("internetContent", IOUtil.encodeBase64AsString(mimeContent)));
|
||||
PropPatchMethod propPatchMethod = new PropPatchMethod(encodedHref, propertyList);
|
||||
int patchStatus = DavGatewayHttpClientFacade.executeHttpMethod(httpClient, propPatchMethod);
|
||||
if (patchStatus != HttpStatus.SC_MULTI_STATUS) {
|
||||
|
|
Loading…
Reference in New Issue