mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 03:02:22 -05:00
Caldav: move delete broken event logic to DavExchangeSession
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1381 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
4d02621332
commit
bd6bf0b395
@ -1978,15 +1978,6 @@ public abstract class ExchangeSession {
|
||||
protected HttpException buildHttpException(Exception e) {
|
||||
String message = "Unable to get event " + getName() + " subject: "+subject+" at " + permanentUrl + ": " + e.getMessage();
|
||||
LOGGER.warn(message);
|
||||
// try to move broken event to trash
|
||||
if (Settings.getBooleanProperty("davmail.deleteBroken")) {
|
||||
LOGGER.warn("Deleting broken event at: " + permanentUrl);
|
||||
try {
|
||||
deleteItem(folderPath, itemName);
|
||||
} catch (IOException ioe) {
|
||||
LOGGER.warn("Unable to delete broken event at: " + permanentUrl);
|
||||
}
|
||||
}
|
||||
return new HttpException(message);
|
||||
}
|
||||
|
||||
|
@ -1263,7 +1263,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
@Override
|
||||
public byte[] getEventContent() throws IOException {
|
||||
byte[] result;
|
||||
LOGGER.debug("Get event subject: "+subject+ " permanentUrl: " + permanentUrl);
|
||||
LOGGER.debug("Get event subject: " + subject + " permanentUrl: " + permanentUrl);
|
||||
// try to get PR_INTERNET_CONTENT
|
||||
try {
|
||||
result = getICSFromInternetContentProperty();
|
||||
@ -1281,6 +1281,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
} catch (DavException e) {
|
||||
throw buildHttpException(e);
|
||||
} catch (IOException e) {
|
||||
deleteBroken();
|
||||
throw buildHttpException(e);
|
||||
} catch (MessagingException e) {
|
||||
throw buildHttpException(e);
|
||||
@ -1288,6 +1289,18 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void deleteBroken() {
|
||||
// try to delete broken event
|
||||
if (Settings.getBooleanProperty("davmail.deleteBroken")) {
|
||||
LOGGER.warn("Deleting broken event at: " + permanentUrl);
|
||||
try {
|
||||
DavGatewayHttpClientFacade.executeDeleteMethod(httpClient, permanentUrl);
|
||||
} catch (IOException ioe) {
|
||||
LOGGER.warn("Unable to delete broken event at: " + permanentUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected PutMethod internalCreateOrUpdate(String encodedHref, byte[] mimeContent) throws IOException {
|
||||
PutMethod putmethod = new PutMethod(encodedHref);
|
||||
putmethod.setRequestHeader("Translate", "f");
|
||||
|
Loading…
Reference in New Issue
Block a user