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:
parent
8bfa014ab3
commit
8a40476649
@ -551,12 +551,14 @@ public class ExchangeSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void getWellKnownFolders() throws IOException {
|
protected void getWellKnownFolders() throws DavMailException {
|
||||||
// Retrieve well known URLs
|
// Retrieve well known URLs
|
||||||
MultiStatusResponse[] responses = DavGatewayHttpClientFacade.executePropFindMethod(
|
MultiStatusResponse[] responses;
|
||||||
|
try {
|
||||||
|
responses = DavGatewayHttpClientFacade.executePropFindMethod(
|
||||||
httpClient, URIUtil.encodePath(mailPath), 0, WELL_KNOWN_FOLDERS);
|
httpClient, URIUtil.encodePath(mailPath), 0, WELL_KNOWN_FOLDERS);
|
||||||
if (responses.length == 0) {
|
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);
|
DavPropertySet properties = responses[0].getProperties(HttpStatus.SC_OK);
|
||||||
inboxUrl = getURIPropertyIfExists(properties, "inbox", URN_SCHEMAS_HTTPMAIL);
|
inboxUrl = getURIPropertyIfExists(properties, "inbox", URN_SCHEMAS_HTTPMAIL);
|
||||||
@ -574,6 +576,10 @@ public class ExchangeSession {
|
|||||||
" Calendar URL : " + calendarUrl +
|
" Calendar URL : " + calendarUrl +
|
||||||
" Contacts URL : " + contactsUrl
|
" Contacts URL : " + contactsUrl
|
||||||
);
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOGGER.error(e.getMessage());
|
||||||
|
throw new DavMailException("EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER", mailPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1539,9 +1545,9 @@ public class ExchangeSession {
|
|||||||
baos.close();
|
baos.close();
|
||||||
result = fixICS(new String(baos.toByteArray(), "UTF-8"), true);
|
result = fixICS(new String(baos.toByteArray(), "UTF-8"), true);
|
||||||
} catch (IOException e) {
|
} 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) {
|
} catch (MessagingException e) {
|
||||||
LOGGER.warn("Unable to get event at " + href+": "+e.getMessage());
|
LOGGER.warn("Unable to get event at " + href + ": " + e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
method.releaseConnection();
|
method.releaseConnection();
|
||||||
}
|
}
|
||||||
@ -2411,12 +2417,12 @@ public class ExchangeSession {
|
|||||||
MultiStatusResponse[] responses = DavGatewayHttpClientFacade.executePropFindMethod(
|
MultiStatusResponse[] responses = DavGatewayHttpClientFacade.executePropFindMethod(
|
||||||
httpClient, URIUtil.encodePath(mailPath), 0, DISPLAY_NAME);
|
httpClient, URIUtil.encodePath(mailPath), 0, DISPLAY_NAME);
|
||||||
if (responses.length == 0) {
|
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 {
|
} else {
|
||||||
displayName = getPropertyIfExists(responses[0].getProperties(HttpStatus.SC_OK), "displayname", Namespace.getNamespace("DAV:"));
|
displayName = getPropertyIfExists(responses[0].getProperties(HttpStatus.SC_OK), "displayname", Namespace.getNamespace("DAV:"));
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} 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;
|
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_UNABLE_TO_CREATE_MESSAGE=Unable to create message {0}: {1}{2}{3}
|
||||||
EXCEPTION_GET_FAILED=Get request failed with status {0} at {1}
|
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_FOLDER=Unable to get folder at {0}
|
||||||
EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER=Unable to get mail folder
|
EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER=Unable to get mail folder at {0}
|
||||||
EXCEPTION_UNABLE_TO_GET_MAIL_FOLDERS=Unable to get mail folders
|
|
||||||
EXCEPTION_UNABLE_TO_GET_PROPERTY=Unable to get property {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_MOVE_FOLDER=Unable to move folder, target already exists
|
||||||
EXCEPTION_UNABLE_TO_COPY_MESSAGE=Unable to copy message, 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_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_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_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_FOLDER=Impossible d''obtenir le dossier de messagerie à l''adresse {0}
|
||||||
EXCEPTION_UNABLE_TO_GET_MAIL_FOLDERS=Impossible d''obtenir les répertoires de messagerie
|
|
||||||
EXCEPTION_UNABLE_TO_GET_PROPERTY=Impossible d''obtenir la propriété {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_MOVE_FOLDER=Impossible de déplacer le dossier, la cible existe
|
||||||
EXCEPTION_UNABLE_TO_COPY_MESSAGE=Impossible de copier le message, la cible existe
|
EXCEPTION_UNABLE_TO_COPY_MESSAGE=Impossible de copier le message, la cible existe
|
||||||
|
Loading…
Reference in New Issue
Block a user