1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-08-13 16:53:51 -04:00

Improve error handling on invalid URL

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@732 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-09-20 14:10:54 +00:00
parent 8bfa014ab3
commit 8a40476649
3 changed files with 33 additions and 29 deletions

View File

@ -551,12 +551,14 @@ public class ExchangeSession {
}
}
protected void getWellKnownFolders() throws IOException {
protected void getWellKnownFolders() throws DavMailException {
// Retrieve well known URLs
MultiStatusResponse[] responses = DavGatewayHttpClientFacade.executePropFindMethod(
MultiStatusResponse[] responses;
try {
responses = DavGatewayHttpClientFacade.executePropFindMethod(
httpClient, URIUtil.encodePath(mailPath), 0, WELL_KNOWN_FOLDERS);
if (responses.length == 0) {
throw new DavMailException("EXCEPTION_UNABLE_TO_GET_MAIL_FOLDERS");
throw new DavMailException("EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER", mailPath);
}
DavPropertySet properties = responses[0].getProperties(HttpStatus.SC_OK);
inboxUrl = getURIPropertyIfExists(properties, "inbox", URN_SCHEMAS_HTTPMAIL);
@ -574,6 +576,10 @@ public class ExchangeSession {
" Calendar URL : " + calendarUrl +
" Contacts URL : " + contactsUrl
);
} catch (IOException e) {
LOGGER.error(e.getMessage());
throw new DavMailException("EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER", mailPath);
}
}
/**
@ -2411,12 +2417,12 @@ public class ExchangeSession {
MultiStatusResponse[] responses = DavGatewayHttpClientFacade.executePropFindMethod(
httpClient, URIUtil.encodePath(mailPath), 0, DISPLAY_NAME);
if (responses.length == 0) {
LOGGER.warn(new BundleMessage("EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER"));
LOGGER.warn(new BundleMessage("EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER", mailPath));
} else {
displayName = getPropertyIfExists(responses[0].getProperties(HttpStatus.SC_OK), "displayname", Namespace.getNamespace("DAV:"));
}
} catch (IOException e) {
LOGGER.warn(new BundleMessage("EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER"));
LOGGER.warn(new BundleMessage("EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER", mailPath));
}
return displayName;
}

View File

@ -27,8 +27,7 @@ EXCEPTION_NETWORK_DOWN=All network interfaces down or host unreachable !
EXCEPTION_UNABLE_TO_CREATE_MESSAGE=Unable to create message {0}: {1}{2}{3}
EXCEPTION_GET_FAILED=Get request failed with status {0} at {1}
EXCEPTION_UNABLE_TO_GET_FOLDER=Unable to get folder at {0}
EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER=Unable to get mail folder
EXCEPTION_UNABLE_TO_GET_MAIL_FOLDERS=Unable to get mail folders
EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER=Unable to get mail folder at {0}
EXCEPTION_UNABLE_TO_GET_PROPERTY=Unable to get property {0}
EXCEPTION_UNABLE_TO_MOVE_FOLDER=Unable to move folder, target already exists
EXCEPTION_UNABLE_TO_COPY_MESSAGE=Unable to copy message, target already exists

View File

@ -26,8 +26,7 @@ EXCEPTION_INVALID_SEARCH_PARAMETERS=Parem
EXCEPTION_NETWORK_DOWN=Toutes les interfaces réseaux sont indisponibles ou serveur non joignable !
EXCEPTION_UNABLE_TO_CREATE_MESSAGE=Impossible de créer le message {0} : {1}{2}{3}
EXCEPTION_UNABLE_TO_GET_FOLDER=Impossible d''obtenir le dossier {0}
EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER=Impossible d''obtenir le dossier de messagerie
EXCEPTION_UNABLE_TO_GET_MAIL_FOLDERS=Impossible d''obtenir les répertoires de messagerie
EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER=Impossible d''obtenir le dossier de messagerie à l''adresse {0}
EXCEPTION_UNABLE_TO_GET_PROPERTY=Impossible d''obtenir la propriété {0}
EXCEPTION_UNABLE_TO_MOVE_FOLDER=Impossible de déplacer le dossier, la cible existe
EXCEPTION_UNABLE_TO_COPY_MESSAGE=Impossible de copier le message, la cible existe