1
0
mirror of https://github.com/moparisthebest/davmail synced 2025-02-28 17:31:52 -05:00

Caldav: improve error handling, 440 means 403 forbidden on Exchange

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@666 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-08-11 16:55:35 +00:00
parent e161efce5b
commit 2b65587c07
2 changed files with 18 additions and 5 deletions

View File

@ -1925,6 +1925,10 @@ public class ExchangeSession {
putmethod.releaseConnection();
}
EventResult eventResult = new EventResult();
// 440 means forbidden on Exchange
if (status == 440) {
status = HttpStatus.SC_FORBIDDEN;
}
eventResult.status = status;
if (putmethod.getResponseHeader("GetETag") != null) {
eventResult.etag = putmethod.getResponseHeader("GetETag").getValue();

View File

@ -48,7 +48,7 @@ public final class DavGatewayHttpClientFacade {
static final long ONE_MINUTE = 60000;
static Thread httpConnectionManagerThread ;
static Thread httpConnectionManagerThread;
static {
DavGatewayHttpClientFacade.start();
@ -229,11 +229,13 @@ public final class DavGatewayHttpClientFacade {
"</d:searchrequest>";
DavMethodBase searchMethod = new DavMethodBase(path) {
@Override public String getName() {
@Override
public String getName() {
return "SEARCH";
}
@Override protected boolean isSuccess(int statusCode) {
@Override
protected boolean isSuccess(int statusCode) {
return statusCode == 207;
}
};
@ -310,7 +312,13 @@ public final class DavGatewayHttpClientFacade {
* @return Http Exception
*/
public static HttpException buildHttpException(HttpMethod method) {
return new HttpException(method.getStatusCode() + " " + method.getStatusText());
int status = method.getStatusCode();
// 440 means forbidden on Exchange
if (status == 440) {
return new HttpException(HttpStatus.SC_FORBIDDEN + " " + HttpStatus.getStatusText(HttpStatus.SC_FORBIDDEN));
} else {
return new HttpException(method.getStatusCode() + " " + method.getStatusText());
}
}
public static void stop() {
@ -328,7 +336,8 @@ public final class DavGatewayHttpClientFacade {
multiThreadedHttpConnectionManager = new MultiThreadedHttpConnectionManager();
multiThreadedHttpConnectionManager.getParams().setDefaultMaxConnectionsPerHost(100);
httpConnectionManagerThread = new Thread(HttpConnectionManager.class.getSimpleName()) {
@Override public void run() {
@Override
public void run() {
boolean terminated = false;
while (!terminated) {
try {