From 565f037df2326a4d73a09b78fb1b8407144ce014 Mon Sep 17 00:00:00 2001 From: mguessan Date: Mon, 7 Dec 2009 21:57:56 +0000 Subject: [PATCH] Caldav: Improve error handling on invalid events git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@875 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/exchange/ExchangeSession.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java index 6faa55c0..a7ac33b5 100644 --- a/src/java/davmail/exchange/ExchangeSession.java +++ b/src/java/davmail/exchange/ExchangeSession.java @@ -1743,7 +1743,7 @@ public class ExchangeSession { * @throws IOException on error */ public String getICS() throws IOException { - String result = null; + String result; LOGGER.debug("Get event: " + permanentUrl); // try to get PR_INTERNET_CONTENT try { @@ -1760,15 +1760,21 @@ public class ExchangeSession { } } } catch (DavException e) { - LOGGER.warn("Unable to get event at " + permanentUrl + ": " + e.getMessage()); + throw buildHttpException(e); } catch (IOException e) { - LOGGER.warn("Unable to get event at " + permanentUrl + ": " + e.getMessage()); + throw buildHttpException(e); } catch (MessagingException e) { - LOGGER.warn("Unable to get event at " + permanentUrl + ": " + e.getMessage()); + throw buildHttpException(e); } return result; } + protected HttpException buildHttpException(Exception e) { + String message = "Unable to get event "+getName()+" at " + permanentUrl + ": " + e.getMessage(); + LOGGER.warn(message); + return new HttpException(message); + } + /** * Get event name (file name part in URL). *