do not send error to client after a socket exception (connection closed)

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@88 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2007-10-23 20:46:40 +00:00
parent 337c004247
commit cc2760f5cf
1 changed files with 14 additions and 1 deletions

View File

@ -1,11 +1,12 @@
package davmail.pop;
import davmail.AbstractConnection;
import davmail.tray.DavGatewayTray;
import davmail.exchange.ExchangeSession;
import davmail.tray.DavGatewayTray;
import java.io.IOException;
import java.net.Socket;
import java.net.SocketException;
import java.util.Date;
import java.util.List;
import java.util.StringTokenizer;
@ -102,6 +103,9 @@ public class PopConnection extends AbstractConnection {
messages = session.getAllMessages();
sendOK("PASS");
state = AUTHENTICATED;
} catch (SocketException e) {
// can not send error to client after a socket exception
DavGatewayTray.warn("Client closed connection ", e);
} catch (Exception e) {
String message = e.getMessage();
if (message == null) {
@ -139,6 +143,9 @@ public class PopConnection extends AbstractConnection {
messages.get(messageNumber).write(os);
sendClient("");
sendClient(".");
} catch (SocketException e) {
// can not send error to client after a socket exception
DavGatewayTray.warn("Client closed connection ", e);
} catch (Exception e) {
DavGatewayTray.error("Error retreiving message", e);
sendERR("error retreiving message " + e + " " + e.getMessage());
@ -153,6 +160,9 @@ public class PopConnection extends AbstractConnection {
nextToken()) - 1;
messages.get(messageNumber).delete();
sendOK("DELETE");
} catch (SocketException e) {
// can not send error to client after a socket exception
DavGatewayTray.warn("Client closed connection ", e);
} catch (Exception e) {
DavGatewayTray.error("Error deleting message", e);
sendERR("error deleting message");
@ -172,6 +182,9 @@ public class PopConnection extends AbstractConnection {
sendClient(".");
}
sendOK("TOP");
} catch (SocketException e) {
// can not send error to client after a socket exception
DavGatewayTray.warn("Client closed connection ", e);
} catch (Exception e) {
sendERR("error retreiving top of messages");
}