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