From 023736018c9079f6bdbf3dad7a18d507604849af Mon Sep 17 00:00:00 2001 From: mguessan Date: Fri, 15 May 2009 12:38:24 +0000 Subject: [PATCH] Improve network down detection for Caldav git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@564 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/exchange/ExchangeSession.java | 7 ++++++- src/java/davmailmessages.properties | 2 +- src/java/davmailmessages_fr.properties | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java index e866ce5f..264ae6ba 100644 --- a/src/java/davmail/exchange/ExchangeSession.java +++ b/src/java/davmail/exchange/ExchangeSession.java @@ -30,6 +30,7 @@ import java.io.*; import java.net.HttpURLConnection; import java.net.URL; import java.net.UnknownHostException; +import java.net.NoRouteToHostException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @@ -217,11 +218,15 @@ public class ExchangeSession { } - public boolean isExpired() { + public boolean isExpired() throws NoRouteToHostException, UnknownHostException { boolean isExpired = false; try { DavGatewayHttpClientFacade.executePropFindMethod( httpClient, URIUtil.encodePath(inboxUrl), 0, DISPLAY_NAME); + } catch (UnknownHostException exc) { + throw exc; + } catch (NoRouteToHostException exc) { + throw exc; } catch (IOException e) { isExpired = true; } diff --git a/src/java/davmailmessages.properties b/src/java/davmailmessages.properties index 91865157..b3c2f25f 100644 --- a/src/java/davmailmessages.properties +++ b/src/java/davmailmessages.properties @@ -198,7 +198,7 @@ EXCEPTION_INVALID_RECIPIENT=Invalid recipient: {0} EXCEPTION_UNSUPPORTED_VALUE=Unsupported value: {0} EXCEPTION_INVALID_CONTENT_TYPE=Invalid content type: {0} EXCEPTION_INVALID_SEARCH_PARAMETERS=Invalid search parameters: {0} -EXCEPTION_NETWORK_DOWN=All network interfaces down ! +EXCEPTION_NETWORK_DOWN=All network interfaces down or host unreachable ! EXCEPTION_DAVMAIL_CONFIGURATION=DavMail configuration exception: \n{0} EXCEPTION_UNKNOWN_HOST=Unknown host {0} EXCEPTION_CONNECTION_FAILED=Unable to connect to OWA at {0}, status code {1}, check configuration diff --git a/src/java/davmailmessages_fr.properties b/src/java/davmailmessages_fr.properties index 1ae47d43..21d5b1a7 100644 --- a/src/java/davmailmessages_fr.properties +++ b/src/java/davmailmessages_fr.properties @@ -197,7 +197,7 @@ EXCEPTION_INVALID_RECIPIENT=Destinataire invalide : {0} EXCEPTION_UNSUPPORTED_VALUE=Valeur non supportée : {0} EXCEPTION_INVALID_CONTENT_TYPE=Type de contenu invalide : {0} EXCEPTION_INVALID_SEARCH_PARAMETERS=Paremètres de recherche invalides : {0} -EXCEPTION_NETWORK_DOWN=Toutes les interfaces réseaux sont indisponibles ! +EXCEPTION_NETWORK_DOWN=Toutes les interfaces réseaux sont indisponibles ou serveur non joignable ! EXCEPTION_DAVMAIL_CONFIGURATION=Erreur de configuration DavMail : \n{0} EXCEPTION_UNKNOWN_HOST=Nom de serveur {0} invalide EXCEPTION_CONNECTION_FAILED=Connection OWA à {0} impossible, code retour {1}, vérifier la configuration