1
0
mirror of https://github.com/moparisthebest/davmail synced 2025-02-28 09:21:49 -05:00

No error on SocketException (client closed connection)

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@202 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2008-12-05 08:48:54 +00:00
parent 0bea11cb12
commit 5212b594cf
3 changed files with 17 additions and 8 deletions

View File

@ -14,6 +14,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.Socket; import java.net.Socket;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
import java.net.SocketException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;
@ -228,6 +229,9 @@ public class LdapConnection extends AbstractConnection {
handleRequest(new BerDecoder(inbuf, 0, offset)); handleRequest(new BerDecoder(inbuf, 0, offset));
} }
} catch (SocketException e) {
DavGatewayTray.debug("Connection closed");
} catch (SocketTimeoutException e) { } catch (SocketTimeoutException e) {
DavGatewayTray.debug("Closing connection on timeout"); DavGatewayTray.debug("Closing connection on timeout");
} catch (IOException e) { } catch (IOException e) {

View File

@ -134,12 +134,12 @@ public class PopConnection extends AbstractConnection {
String token = tokens.nextToken(); String token = tokens.nextToken();
try { try {
int messageNumber = Integer.valueOf(token); int messageNumber = Integer.valueOf(token);
ExchangeSession.Message message = messages.get(messageNumber-1); ExchangeSession.Message message = messages.get(messageNumber - 1);
sendOK(""+messageNumber+" "+message.size); sendOK("" + messageNumber + " " + message.size);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
sendERR("Invalid message index: "+token); sendERR("Invalid message index: " + token);
} catch (IndexOutOfBoundsException e) { } catch (IndexOutOfBoundsException e) {
sendERR("Invalid message index: "+token); sendERR("Invalid message index: " + token);
} }
} else { } else {
sendOK(messages.size() + sendOK(messages.size() +
@ -193,7 +193,7 @@ public class PopConnection extends AbstractConnection {
try { try {
message = Integer.valueOf(tokens.nextToken()); message = Integer.valueOf(tokens.nextToken());
int lines = Integer.valueOf(tokens.nextToken()); int lines = Integer.valueOf(tokens.nextToken());
ExchangeSession.Message m = messages.get(message-1); ExchangeSession.Message m = messages.get(message - 1);
sendOK(""); sendOK("");
m.write(new TopOutputStream(os, lines)); m.write(new TopOutputStream(os, lines));
sendClient(""); sendClient("");
@ -202,7 +202,7 @@ public class PopConnection extends AbstractConnection {
// can not send error to client after a socket exception // can not send error to client after a socket exception
DavGatewayTray.warn("Client closed connection ", e); DavGatewayTray.warn("Client closed connection ", e);
} catch (IndexOutOfBoundsException e) { } catch (IndexOutOfBoundsException e) {
sendERR("Invalid message index: "+message); sendERR("Invalid message index: " + message);
} catch (Exception e) { } catch (Exception e) {
sendERR("error retreiving top of messages"); sendERR("error retreiving top of messages");
DavGatewayTray.error(e.getMessage(), e); DavGatewayTray.error(e.getMessage(), e);
@ -287,13 +287,13 @@ public class PopConnection extends AbstractConnection {
STATE = START; STATE = START;
} }
} else if (STATE == CRLF) { } else if (STATE == CRLF) {
if (b == '\r') { if (b == '\r') {
STATE = CRLFCR; STATE = CRLFCR;
} else { } else {
STATE = START; STATE = START;
} }
} else if (STATE == CRLFCR) { } else if (STATE == CRLFCR) {
if (b == '\n') { if (b == '\n') {
STATE = BODY; STATE = BODY;
} else { } else {
STATE = START; STATE = START;

View File

@ -6,6 +6,7 @@ import davmail.tray.DavGatewayTray;
import java.io.IOException; import java.io.IOException;
import java.net.Socket; import java.net.Socket;
import java.net.SocketException;
import java.util.Date; import java.util.Date;
import java.util.StringTokenizer; import java.util.StringTokenizer;
@ -122,6 +123,9 @@ public class SmtpConnection extends AbstractConnection {
os.flush(); os.flush();
} }
} catch (SocketException e) {
DavGatewayTray.debug("Connection closed");
} catch (IOException e) { } catch (IOException e) {
DavGatewayTray.error(e.getMessage()); DavGatewayTray.error(e.getMessage());
try { try {
@ -137,6 +141,7 @@ public class SmtpConnection extends AbstractConnection {
/** /**
* Create authenticated session with Exchange server * Create authenticated session with Exchange server
*
* @throws IOException on error * @throws IOException on error
*/ */
protected void authenticate() throws IOException { protected void authenticate() throws IOException {