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=";
|
static final String MAILBOX_BASE = "/cn=";
|
||||||
|
|
||||||
protected void getEmailAndAliasFromOptions() {
|
protected void getEmailAndAliasFromOptions() {
|
||||||
|
synchronized (httpClient.getState()) {
|
||||||
Cookie[] currentCookies = httpClient.getState().getCookies();
|
Cookie[] currentCookies = httpClient.getState().getCookies();
|
||||||
// get user mail URL from html body
|
// get user mail URL from html body
|
||||||
BufferedReader optionsPageReader = null;
|
BufferedReader optionsPageReader = null;
|
||||||
|
@ -3304,11 +3305,12 @@ public abstract class ExchangeSession {
|
||||||
String line;
|
String line;
|
||||||
|
|
||||||
// find email and alias
|
// find email and alias
|
||||||
|
//noinspection StatementWithEmptyBody
|
||||||
while ((line = optionsPageReader.readLine()) != null
|
while ((line = optionsPageReader.readLine()) != null
|
||||||
&& (line.indexOf('[') == -1
|
&& (line.indexOf('[') == -1
|
||||||
|| line.indexOf('@') == -1
|
|| line.indexOf('@') == -1
|
||||||
|| line.indexOf(']') == -1)
|
|| line.indexOf(']') == -1)
|
||||||
&& line.toLowerCase().indexOf(MAILBOX_BASE) == -1) {
|
&& !line.toLowerCase().contains(MAILBOX_BASE)) {
|
||||||
}
|
}
|
||||||
if (line != null) {
|
if (line != null) {
|
||||||
int start = line.toLowerCase().lastIndexOf(MAILBOX_BASE) + MAILBOX_BASE.length();
|
int start = line.toLowerCase().lastIndexOf(MAILBOX_BASE) + MAILBOX_BASE.length();
|
||||||
|
@ -3333,6 +3335,7 @@ public abstract class ExchangeSession {
|
||||||
optionsMethod.releaseConnection();
|
optionsMethod.releaseConnection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current user email
|
* Get current user email
|
||||||
|
|
|
@ -752,7 +752,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkPublicFolder() {
|
protected void checkPublicFolder() {
|
||||||
|
synchronized (httpClient.getState()) {
|
||||||
Cookie[] currentCookies = httpClient.getState().getCookies();
|
Cookie[] currentCookies = httpClient.getState().getCookies();
|
||||||
// check public folder access
|
// check public folder access
|
||||||
try {
|
try {
|
||||||
|
@ -779,6 +779,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||||
publicFolderUrl = PUBLIC_ROOT;
|
publicFolderUrl = PUBLIC_ROOT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void getWellKnownFolders() throws DavMailException {
|
protected void getWellKnownFolders() throws DavMailException {
|
||||||
// Retrieve well known URLs
|
// Retrieve well known URLs
|
||||||
|
@ -1099,7 +1100,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||||
// workaround for messages in Sent folder
|
// workaround for messages in Sent folder
|
||||||
if (!messageHeaders.contains("From:")) {
|
if (!messageHeaders.contains("From:")) {
|
||||||
String from = getItemProperty(permanentUrl, "from");
|
String from = getItemProperty(permanentUrl, "from");
|
||||||
messageHeaders = "From: "+from+ '\n' +messageHeaders;
|
messageHeaders = "From: " + from + '\n' + messageHeaders;
|
||||||
}
|
}
|
||||||
result = new ByteArrayInputStream(messageHeaders.getBytes("UTF-8"));
|
result = new ByteArrayInputStream(messageHeaders.getBytes("UTF-8"));
|
||||||
}
|
}
|
||||||
|
@ -1358,7 +1359,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||||
@Override
|
@Override
|
||||||
public byte[] getEventContent() throws IOException {
|
public byte[] getEventContent() throws IOException {
|
||||||
byte[] result = null;
|
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
|
// do not try to load tasks MIME body
|
||||||
if (!"urn:content-classes:task".equals(contentClass)) {
|
if (!"urn:content-classes:task".equals(contentClass)) {
|
||||||
// try to get PR_INTERNET_CONTENT
|
// try to get PR_INTERNET_CONTENT
|
||||||
|
@ -1706,7 +1707,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||||
// Set contentclass to make ActiveSync happy
|
// Set contentclass to make ActiveSync happy
|
||||||
propertyList.add(Field.createDavProperty("contentclass", contentClass));
|
propertyList.add(Field.createDavProperty("contentclass", contentClass));
|
||||||
// ... but also set PR_INTERNET_CONTENT to preserve custom properties
|
// ... 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);
|
PropPatchMethod propPatchMethod = new PropPatchMethod(encodedHref, propertyList);
|
||||||
int patchStatus = DavGatewayHttpClientFacade.executeHttpMethod(httpClient, propPatchMethod);
|
int patchStatus = DavGatewayHttpClientFacade.executeHttpMethod(httpClient, propPatchMethod);
|
||||||
if (patchStatus != HttpStatus.SC_MULTI_STATUS) {
|
if (patchStatus != HttpStatus.SC_MULTI_STATUS) {
|
||||||
|
|
Loading…
Reference in New Issue