From 46e7283fb238befc5e48b480b3b36c43bcf8e23b Mon Sep 17 00:00:00 2001 From: mguessan Date: Sun, 24 Jan 2010 20:41:02 +0000 Subject: [PATCH] Improve error handling: detect SocketException to avoid client socket closed errors git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@927 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/imap/ImapConnection.java | 2 ++ src/java/davmail/ldap/LdapConnection.java | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/java/davmail/imap/ImapConnection.java b/src/java/davmail/imap/ImapConnection.java index 0242936b..13880cb6 100644 --- a/src/java/davmail/imap/ImapConnection.java +++ b/src/java/davmail/imap/ImapConnection.java @@ -331,6 +331,8 @@ public class ImapConnection extends AbstractConnection { ExchangeSession.Message message = rangeIterator.next(); try { handleFetch(message, rangeIterator.currentIndex, parameters); + } catch (SocketException e) { + DavGatewayTray.warn(new BundleMessage("LOG_CLIENT_CLOSED_CONNECTION"), e); } catch (IOException e) { DavGatewayTray.log(e); sendClient(commandId + " NO Unable to retrieve message: " + e.getMessage()); diff --git a/src/java/davmail/ldap/LdapConnection.java b/src/java/davmail/ldap/LdapConnection.java index 1caef39e..a561e863 100644 --- a/src/java/davmail/ldap/LdapConnection.java +++ b/src/java/davmail/ldap/LdapConnection.java @@ -1272,6 +1272,9 @@ public class LdapConnection extends AbstractConnection { DavGatewayTray.debug(new BundleMessage("LOG_LDAP_REQ_SEARCH_SUCCESS", currentMessageId)); sendClient(currentMessageId, LDAP_REP_RESULT, LDAP_SUCCESS, ""); } + } catch (SocketException e) { + // client closed connection + DavGatewayTray.debug(new BundleMessage("LOG_CLIENT_CLOSED_CONNECTION")); } catch (IOException e) { DavGatewayTray.log(e); try {