IMAP: improve error logging on network down

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@738 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-09-22 09:03:32 +00:00
parent a5d91980b1
commit 94ee1091a2
5 changed files with 13 additions and 4 deletions

View File

@ -163,7 +163,7 @@ public final class ExchangeSessionFactory {
BundleMessage message = new BundleMessage("EXCEPTION_CONNECT", exc.getClass().getName(), exc.getMessage());
if (errorSent) {
ExchangeSession.LOGGER.warn(message);
throw new NetworkDownException("EXCEPTION_DAVMAIL_CONFIGURATION");
throw new NetworkDownException("EXCEPTION_DAVMAIL_CONFIGURATION", message);
} else {
// Mark that an error has been sent so you only get one
// error in a row (not a repeating string of errors).

View File

@ -31,4 +31,13 @@ public class NetworkDownException extends DavMailException {
public NetworkDownException(String key) {
super(key);
}
/**
* Build a network down exception with the provided BundleMessage key.
* @param key message key
* @param message detailed message
*/
public NetworkDownException(String key, Object message) {
super(key, message);
}
}

View File

@ -470,7 +470,7 @@ public class ImapConnection extends AbstractConnection {
} catch (Exception e) {
DavGatewayTray.log(e);
try {
String message = (e.getMessage() == null) ? e.toString() : e.getMessage();
String message = ((e.getMessage() == null) ? e.toString() : e.getMessage()).replaceAll("\\n", " ");
if (commandId != null) {
sendClient(commandId + " BAD unable to handle request: " + message);
} else {