Caldav: fix HTTP status code on event delete

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@444 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-03-16 16:01:07 +00:00
parent 8401d86b84
commit 2c7add2af3
1 changed files with 7 additions and 4 deletions

View File

@ -1612,20 +1612,23 @@ public class ExchangeSession {
}
public int deleteEvent(String path, String eventName) throws IOException {
int status;
if (path.startsWith("INBOX")) {
// do not delete calendar messages, move to trash
moveToTrash(URIUtil.encodePath(getFolderPath(URIUtil.decode(path))), eventName);
status = HttpStatus.SC_OK;
} else {
DeleteMethod method = new DeleteMethod(URIUtil.encodePath(getFolderPath(URIUtil.decode(path)))+"/"+eventName);
int status = wdr.retrieveSessionInstance().executeMethod(method);
if (status != HttpStatus.SC_OK) {
status = wdr.retrieveSessionInstance().executeMethod(method);
// do not throw error if already deleted
if (status != HttpStatus.SC_OK && status != HttpStatus.SC_NOT_FOUND) {
HttpException ex = new HttpException();
ex.setReasonCode(status);
ex.setReason(wdr.getStatusMessage());
throw ex;
}
}
return wdr.getStatusCode();
return status;
}
public String getInboxCtag() throws IOException {
@ -1640,7 +1643,7 @@ public class ExchangeSession {
String ctag = null;
Enumeration calendarEnum = wdr.propfindMethod(folderUrl, 0);
if (!calendarEnum.hasMoreElements()) {
throw new IOException("Unable to get calendar object");
throw new IOException("Unable to get folder object");
}
while (calendarEnum.hasMoreElements()) {
ResponseEntity calendarResponse = (ResponseEntity) calendarEnum.