mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-12 10:42:21 -05: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:
parent
8bfa014ab3
commit
8a40476649
@ -551,29 +551,35 @@ public class ExchangeSession {
|
||||
}
|
||||
}
|
||||
|
||||
protected void getWellKnownFolders() throws IOException {
|
||||
protected void getWellKnownFolders() throws DavMailException {
|
||||
// Retrieve well known URLs
|
||||
MultiStatusResponse[] responses = DavGatewayHttpClientFacade.executePropFindMethod(
|
||||
httpClient, URIUtil.encodePath(mailPath), 0, WELL_KNOWN_FOLDERS);
|
||||
if (responses.length == 0) {
|
||||
throw new DavMailException("EXCEPTION_UNABLE_TO_GET_MAIL_FOLDERS");
|
||||
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_FOLDER", mailPath);
|
||||
}
|
||||
DavPropertySet properties = responses[0].getProperties(HttpStatus.SC_OK);
|
||||
inboxUrl = getURIPropertyIfExists(properties, "inbox", URN_SCHEMAS_HTTPMAIL);
|
||||
deleteditemsUrl = getURIPropertyIfExists(properties, "deleteditems", URN_SCHEMAS_HTTPMAIL);
|
||||
sentitemsUrl = getURIPropertyIfExists(properties, "sentitems", URN_SCHEMAS_HTTPMAIL);
|
||||
sendmsgUrl = getURIPropertyIfExists(properties, "sendmsg", URN_SCHEMAS_HTTPMAIL);
|
||||
draftsUrl = getURIPropertyIfExists(properties, "drafts", URN_SCHEMAS_HTTPMAIL);
|
||||
calendarUrl = getURIPropertyIfExists(properties, "calendar", URN_SCHEMAS_HTTPMAIL);
|
||||
contactsUrl = getURIPropertyIfExists(properties, "contacts", URN_SCHEMAS_HTTPMAIL);
|
||||
LOGGER.debug("Inbox URL : " + inboxUrl +
|
||||
" Trash URL : " + deleteditemsUrl +
|
||||
" Sent URL : " + sentitemsUrl +
|
||||
" Send URL : " + sendmsgUrl +
|
||||
" Drafts URL : " + draftsUrl +
|
||||
" Calendar URL : " + calendarUrl +
|
||||
" Contacts URL : " + contactsUrl
|
||||
);
|
||||
} catch (IOException e) {
|
||||
LOGGER.error(e.getMessage());
|
||||
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);
|
||||
deleteditemsUrl = getURIPropertyIfExists(properties, "deleteditems", URN_SCHEMAS_HTTPMAIL);
|
||||
sentitemsUrl = getURIPropertyIfExists(properties, "sentitems", URN_SCHEMAS_HTTPMAIL);
|
||||
sendmsgUrl = getURIPropertyIfExists(properties, "sendmsg", URN_SCHEMAS_HTTPMAIL);
|
||||
draftsUrl = getURIPropertyIfExists(properties, "drafts", URN_SCHEMAS_HTTPMAIL);
|
||||
calendarUrl = getURIPropertyIfExists(properties, "calendar", URN_SCHEMAS_HTTPMAIL);
|
||||
contactsUrl = getURIPropertyIfExists(properties, "contacts", URN_SCHEMAS_HTTPMAIL);
|
||||
LOGGER.debug("Inbox URL : " + inboxUrl +
|
||||
" Trash URL : " + deleteditemsUrl +
|
||||
" Sent URL : " + sentitemsUrl +
|
||||
" Send URL : " + sendmsgUrl +
|
||||
" Drafts URL : " + draftsUrl +
|
||||
" Calendar URL : " + calendarUrl +
|
||||
" Contacts URL : " + contactsUrl
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1539,9 +1545,9 @@ public class ExchangeSession {
|
||||
baos.close();
|
||||
result = fixICS(new String(baos.toByteArray(), "UTF-8"), true);
|
||||
} catch (IOException e) {
|
||||
LOGGER.warn("Unable to get event at " + href+": "+e.getMessage());
|
||||
LOGGER.warn("Unable to get event at " + href + ": " + e.getMessage());
|
||||
} catch (MessagingException e) {
|
||||
LOGGER.warn("Unable to get event at " + href+": "+e.getMessage());
|
||||
LOGGER.warn("Unable to get event at " + href + ": " + e.getMessage());
|
||||
} finally {
|
||||
method.releaseConnection();
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user