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

View File

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

View File

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