1
0
mirror of https://github.com/moparisthebest/davmail synced 2025-02-28 17:31:52 -05:00

Improve authentication failure handling, send explicit message to client

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@52 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2007-04-26 10:29:11 +00:00
parent 4a95e0f121
commit 8ab4d39cc6
8 changed files with 131 additions and 130 deletions

View File

@ -18,17 +18,13 @@ public abstract class AbstractServer extends Thread {
public AbstractServer(int port) { public AbstractServer(int port) {
this.port = port; this.port = port;
try { try {
//noinspection SocketOpenedButNotSafelyClosed
serverSocket = new ServerSocket(port); serverSocket = new ServerSocket(port);
} catch (IOException e) { } catch (IOException e) {
DavGatewayTray.error("Exception creating server socket", e); DavGatewayTray.error("Exception creating server socket", e);
} }
} }
// Exit with an error message, when an exception occurs.
public static void fail(Exception e, String msg) {
System.err.println(msg + ": " + e);
System.exit(1);
}
/** /**
* The body of the server thread. Loop forever, listening for and * The body of the server thread. Loop forever, listening for and
@ -37,10 +33,11 @@ public abstract class AbstractServer extends Thread {
* new Socket. * new Socket.
*/ */
public void run() { public void run() {
Socket clientSocket = null;
try { try {
//noinspection InfiniteLoopStatement //noinspection InfiniteLoopStatement
while (true) { while (true) {
Socket clientSocket = serverSocket.accept(); clientSocket = serverSocket.accept();
DavGatewayTray.debug("Connection from " + clientSocket.getInetAddress() + " on port " + port); DavGatewayTray.debug("Connection from " + clientSocket.getInetAddress() + " on port " + port);
// only accept localhost connections for security reasons // only accept localhost connections for security reasons
if (clientSocket.getInetAddress().toString().indexOf("127.0.0.1") > 0) { if (clientSocket.getInetAddress().toString().indexOf("127.0.0.1") > 0) {
@ -53,6 +50,14 @@ public abstract class AbstractServer extends Thread {
} }
} catch (IOException e) { } catch (IOException e) {
DavGatewayTray.warn("Exception while listening for connections", e); DavGatewayTray.warn("Exception while listening for connections", e);
} finally {
try {
if (clientSocket != null) {
clientSocket.close();
}
} catch (IOException e) {
// ignore
}
} }
} }

View File

@ -160,6 +160,7 @@ public class DavGatewayTray {
ActionListener exitListener = new ActionListener() { ActionListener exitListener = new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
SystemTray.getSystemTray().remove(trayIcon); SystemTray.getSystemTray().remove(trayIcon);
//noinspection CallToSystemExit
System.exit(0); System.exit(0);
} }
}; };

View File

@ -1,6 +1,7 @@
package davmail.exchange; package davmail.exchange;
// Imports // Imports
import java.io.OutputStream; import java.io.OutputStream;
import java.io.FilterOutputStream; import java.io.FilterOutputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -16,18 +17,18 @@ import java.io.UnsupportedEncodingException;
* @author David A. Herman * @author David A. Herman
* @version 1.0 of September 2000 * @version 1.0 of September 2000
* @see java.io.FilterOutputStream * @see java.io.FilterOutputStream
**/ */
public class BASE64EncoderStream extends FilterOutputStream { public class BASE64EncoderStream extends FilterOutputStream {
/** /**
* Useful constant representing the default maximum number of output * Useful constant representing the default maximum number of output
* characters per line (76). * characters per line (76).
**/ */
public static final int LINE_LENGTH = 76; public static final int LINE_LENGTH = 76;
/** /**
* The BASE64 alphabet. * The BASE64 alphabet.
**/ */
private static final byte[] alphabet; private static final byte[] alphabet;
/** /**
@ -45,28 +46,28 @@ public class BASE64EncoderStream extends FilterOutputStream {
/** /**
* The internal buffer of encoded output bytes. * The internal buffer of encoded output bytes.
**/ */
private byte[] output = new byte[4]; private byte[] output = new byte[4];
/** /**
* The internal buffer of input bytes to be encoded. * The internal buffer of input bytes to be encoded.
**/ */
private byte[] input = new byte[3]; private byte[] input = new byte[3];
/** /**
* The index of the next position in the internal buffer of input bytes * The index of the next position in the internal buffer of input bytes
* at which to store input. * at which to store input.
**/ */
private int inputIndex = 0; private int inputIndex = 0;
/** /**
* The number of characters that have been output on the current line. * The number of characters that have been output on the current line.
**/ */
private int chars = 0; private int chars = 0;
/** /**
* The maximum number of characters to output per line. * The maximum number of characters to output per line.
**/ */
private int maxLineLength; private int maxLineLength;
/** /**
@ -74,7 +75,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
* character of output data. This index is generated as input data comes * character of output data. This index is generated as input data comes
* in, sometimes requiring more than one byte of input before it is * in, sometimes requiring more than one byte of input before it is
* completely calculated, so it is shared in the object. * completely calculated, so it is shared in the object.
**/ */
private int index; private int index;
/** /**
@ -82,7 +83,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
* stream, with the default maximum number of characters per line. * stream, with the default maximum number of characters per line.
* *
* @param out output stream * @param out output stream
**/ */
public BASE64EncoderStream(OutputStream out) { public BASE64EncoderStream(OutputStream out) {
this(out, LINE_LENGTH); this(out, LINE_LENGTH);
} }
@ -96,7 +97,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
* *
* @param out the underlying output stream. * @param out the underlying output stream.
* @param max the maximum number of output bytes per line. * @param max the maximum number of output bytes per line.
**/ */
public BASE64EncoderStream(OutputStream out, int max) { public BASE64EncoderStream(OutputStream out, int max) {
super(out); super(out);
maxLineLength = max; maxLineLength = max;
@ -114,7 +115,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
* underlying output stream, and closes the underlying output stream. * underlying output stream, and closes the underlying output stream.
* *
* @throws IOException if an I/O error occurs. * @throws IOException if an I/O error occurs.
**/ */
public void close() throws IOException { public void close() throws IOException {
try { try {
flush(); flush();
@ -122,7 +123,6 @@ public class BASE64EncoderStream extends FilterOutputStream {
// ignore // ignore
} }
// Add a terminating CRLF sequence. // Add a terminating CRLF sequence.
out.write('\r'); out.write('\r');
out.write('\n'); out.write('\n');
@ -137,7 +137,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
* *
* @param b the byte array to be encoded. * @param b the byte array to be encoded.
* @throws IOException if an I/O error occurs. * @throws IOException if an I/O error occurs.
**/ */
public void write(byte b[]) throws IOException { public void write(byte b[]) throws IOException {
write(b, 0, b.length); write(b, 0, b.length);
} }
@ -147,11 +147,11 @@ public class BASE64EncoderStream extends FilterOutputStream {
* at offset <code>off</code>, to be written to the underlying output * at offset <code>off</code>, to be written to the underlying output
* stream. * stream.
* *
* @param b the byte array to be encoded. * @param b the byte array to be encoded.
* @param off the offset at which to start reading from the byte array. * @param off the offset at which to start reading from the byte array.
* @param len the number of bytes to read. * @param len the number of bytes to read.
* @throws IOException if an I/O error occurs. * @throws IOException if an I/O error occurs.
**/ */
public void write(byte b[], int off, int len) throws IOException { public void write(byte b[], int off, int len) throws IOException {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
write(b[off + i]); write(b[off + i]);
@ -167,7 +167,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
* *
* @param b the integer whose low-order byte is to be encoded. * @param b the integer whose low-order byte is to be encoded.
* @throws IOException if an I/O error occurs. * @throws IOException if an I/O error occurs.
**/ */
public void write(int b) throws IOException { public void write(int b) throws IOException {
switch (inputIndex) { switch (inputIndex) {
case 0: case 0:
@ -179,7 +179,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
// ---------------------------- // ----------------------------
// Output: 00 XXXXXX // Output: 00 XXXXXX
input[0] = (byte)(b & 0xFF); input[0] = (byte) (b & 0xFF);
index = ((input[0] & 0xFC) >> 2); index = ((input[0] & 0xFC) >> 2);
output[0] = alphabet[index]; output[0] = alphabet[index];
@ -188,7 +188,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
// to be the last byte of input, then it will // to be the last byte of input, then it will
// already be padded with zeroes, and the rest // already be padded with zeroes, and the rest
// can be padded with '=' characters. // can be padded with '=' characters.
index = ((input[0] & 0x03) << 4); index = ((input[0] & 0x03) << 4);
break; break;
@ -202,7 +202,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
// ---------------------------- // ----------------------------
// Output: 00 XX YYYY // Output: 00 XX YYYY
input[1] = (byte)(b & 0xFF); input[1] = (byte) (b & 0xFF);
// The first two bits of the second output character // The first two bits of the second output character
// have already been calculated and stored in the // have already been calculated and stored in the
@ -216,7 +216,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
// to be the last byte of input, then it will // to be the last byte of input, then it will
// already be padded with zeroes, and the rest // already be padded with zeroes, and the rest
// can be padded with '=' characters. // can be padded with '=' characters.
index = ((input[1] & 0x0F) << 2); index = ((input[1] & 0x0F) << 2);
break; break;
@ -230,7 +230,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
// ---------------------------- // ----------------------------
// Output: 00 XXXX YY // Output: 00 XXXX YY
input[2] = (byte)(b & 0xFF); input[2] = (byte) (b & 0xFF);
// The first four bits of the third output character // The first four bits of the third output character
// have already been calculated and stored in the // have already been calculated and stored in the
@ -268,21 +268,19 @@ public class BASE64EncoderStream extends FilterOutputStream {
* buffer is filled. * buffer is filled.
* *
* @throws IOException if an I/O error occurs. * @throws IOException if an I/O error occurs.
**/ */
private void writeOutput() throws IOException { private void writeOutput() throws IOException {
int newchars = (chars + 4) % maxLineLength; int newchars = (chars + 4) % maxLineLength;
if (newchars == 0) { if (newchars == 0) {
out.write(output); out.write(output);
out.write('\r'); out.write('\r');
out.write('\n'); out.write('\n');
} } else if (newchars < chars) {
else if (newchars < chars) {
out.write(output, 0, 4 - newchars); out.write(output, 0, 4 - newchars);
out.write('\r'); out.write('\r');
out.write('\n'); out.write('\n');
out.write(output, 4 - newchars, newchars); out.write(output, 4 - newchars, newchars);
} } else
else
out.write(output); out.write(output);
chars = newchars; chars = newchars;
} }
@ -297,7 +295,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
* 6.8, for more information. * 6.8, for more information.
* *
* @throws IOException if an I/O error occurs. * @throws IOException if an I/O error occurs.
**/ */
private void pad() throws IOException { private void pad() throws IOException {
// If the input index is 0, then we ended on a multiple of 3 bytes // If the input index is 0, then we ended on a multiple of 3 bytes
// of input, so no padding is necessary. // of input, so no padding is necessary.
@ -325,76 +323,44 @@ public class BASE64EncoderStream extends FilterOutputStream {
} }
} }
public static byte[] encode(byte[] bytes) { public static byte[] encode(byte[] bytes) {
// Note: This is a public method on Sun's implementation // Note: This is a public method on Sun's implementation
// and so it should be supported for compatibility. // and so it should be supported for compatibility.
// Also this method is used by the "B" encoding for now. // Also this method is used by the "B" encoding for now.
// This implementation usesthe encoding stream to // This implementation usesthe encoding stream to
// process the bytes. Possibly, the BASE64 encoding // process the bytes. Possibly, the BASE64 encoding
// stream should use this method for it's encoding. // stream should use this method for it's encoding.
// Variables // Variables
ByteArrayOutputStream byteStream; ByteArrayOutputStream byteStream;
BASE64EncoderStream encoder; BASE64EncoderStream encoder = null;
// Create Streams // Create Streams
byteStream = new ByteArrayOutputStream(); byteStream = new ByteArrayOutputStream();
encoder = new BASE64EncoderStream(byteStream);
try {
// Write Bytes
encoder.write(bytes);
encoder.flush();
encoder.close();
} catch (IOException e) {
// ignore
} // try
// Return Encoded Byte Array
return byteStream.toByteArray();
} // encode()
/**
* <I>For testing.</I> Takes in a file name from the command line, or
* prompts the user for one if there are no command line options, and
* encodes the data in the file to BASE64, outputting the encoded
* data to <code>System.out</code>.
*
* @param args the command line arguments.
**/
public static void main(String args[]) {
String fileName = "";
if (args.length > 0)
fileName = args[0];
else {
System.out.print("File name: ");
java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
try {
fileName = in.readLine();
}
catch (Throwable e) {
e.printStackTrace();
System.exit(1);
}
}
try { try {
java.io.FileInputStream in = new java.io.FileInputStream(fileName); encoder = new BASE64EncoderStream(byteStream);
BASE64EncoderStream out = new BASE64EncoderStream(System.out);
int d = in.read(); // Write Bytes
while (d != -1) { encoder.write(bytes);
out.write(d); encoder.flush();
d = in.read();
} catch (IOException e) {
// ignore
} finally {
try {
if (encoder != null) {
encoder.close();
}
} catch (IOException e) {
// ignore
} }
in.close();
out.close();
} }
catch (Throwable e) {
e.printStackTrace(); // Return Encoded Byte Array
} return byteStream.toByteArray();
}
} // encode()
} }

View File

@ -1,23 +1,23 @@
package davmail.exchange; package davmail.exchange;
import davmail.Settings;
import org.apache.commons.httpclient.*; import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.HeadMethod; import org.apache.commons.httpclient.methods.HeadMethod;
import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.util.URIUtil; import org.apache.commons.httpclient.util.URIUtil;
import org.apache.log4j.Logger;
import org.apache.webdav.lib.Property; import org.apache.webdav.lib.Property;
import org.apache.webdav.lib.ResponseEntity; import org.apache.webdav.lib.ResponseEntity;
import org.apache.webdav.lib.WebdavResource; import org.apache.webdav.lib.WebdavResource;
import org.apache.log4j.Logger;
import org.jdom.Attribute; import org.jdom.Attribute;
import org.jdom.JDOMException;
import org.jdom.input.DOMBuilder; import org.jdom.input.DOMBuilder;
import org.w3c.tidy.Tidy;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.Element; import org.w3c.tidy.Tidy;
import javax.mail.MessagingException; import javax.mail.MessagingException;
import javax.mail.internet.MimeUtility; import javax.mail.internet.MimeUtility;
@ -27,8 +27,6 @@ import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import davmail.Settings;
/** /**
* Exchange session through Outlook Web Access (DAV) * Exchange session through Outlook Web Access (DAV)
*/ */
@ -136,6 +134,9 @@ public class ExchangeSession {
* @param httpClient current Http client * @param httpClient current Http client
*/ */
protected static void configureClient(HttpClient httpClient) { protected static void configureClient(HttpClient httpClient) {
// do not send basic auth automatically
httpClient.getState().setAuthenticationPreemptive(false);
String enableProxy = Settings.getProperty("davmail.enableProxy"); String enableProxy = Settings.getProperty("davmail.enableProxy");
String proxyHost = null; String proxyHost = null;
String proxyPort = null; String proxyPort = null;
@ -177,19 +178,20 @@ public class ExchangeSession {
HttpClient httpClient = new HttpClient(); HttpClient httpClient = new HttpClient();
configureClient(httpClient); configureClient(httpClient);
// get webmail root url (will follow redirects) // get webmail root url (will not follow redirects)
HttpMethod testMethod = new GetMethod(url); HttpMethod testMethod = new GetMethod(url);
testMethod.setFollowRedirects(false);
int status = httpClient.executeMethod(testMethod); int status = httpClient.executeMethod(testMethod);
testMethod.releaseConnection(); testMethod.releaseConnection();
logger.debug("Test configuration status: " + status); logger.debug("Test configuration status: " + status);
if (status != HttpStatus.SC_OK) { if (status != HttpStatus.SC_OK && status != HttpStatus.SC_UNAUTHORIZED) {
throw new IOException("Unable to connect to OWA at " + url + ", status code " + throw new IOException("Unable to connect to OWA at " + url + ", status code " +
status + ", check configuration"); status + ", check configuration");
} }
} catch (Exception exc) { } catch (Exception exc) {
logger.error("DavMail configuration exception: \n"+exc.getMessage(), exc); logger.error("DavMail configuration exception: \n" + exc.getMessage(), exc);
throw new IOException("DavMail configuration exception: \n"+exc.getMessage(), exc); throw new IOException("DavMail configuration exception: \n" + exc.getMessage(), exc);
} }
} }
@ -224,8 +226,6 @@ public class ExchangeSession {
authPrefs.add(AuthPolicy.BASIC); authPrefs.add(AuthPolicy.BASIC);
httpClient.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY,authPrefs); httpClient.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY,authPrefs);
*/ */
// do not send basic auth automatically
httpClient.getState().setAuthenticationPreemptive(false);
configureClient(httpClient); configureClient(httpClient);
@ -272,6 +272,7 @@ public class ExchangeSession {
&& status != HttpStatus.SC_OK) { && status != HttpStatus.SC_OK) {
HttpException ex = new HttpException(); HttpException ex = new HttpException();
ex.setReasonCode(status); ex.setReasonCode(status);
ex.setReason(method.getStatusText());
throw ex; throw ex;
} }
@ -338,14 +339,34 @@ public class ExchangeSession {
wdr.setPath(URIUtil.getPath(inboxUrl)); wdr.setPath(URIUtil.getPath(inboxUrl));
} catch (Exception exc) { } catch (Exception exc) {
logger.error("Exchange login exception ", exc); StringBuffer message = new StringBuffer();
message.append("DavMail login exception: ");
if (exc.getMessage() != null) {
message.append(exc.getMessage());
} else if (exc instanceof HttpException) {
message.append(((HttpException) exc).getReasonCode());
String httpReason = ((HttpException) exc).getReason();
if (httpReason != null) {
message.append(" ");
message.append(httpReason);
}
} else {
message.append(exc);
}
try { try {
System.err.println( message.append("\nWebdav status:");
wdr.getStatusCode() + " " + wdr.getStatusMessage()); message.append(wdr.getStatusCode());
String webdavStatusMessage = wdr.getStatusMessage();
if (webdavStatusMessage != null) {
message.append(webdavStatusMessage);
}
} catch (Exception e) { } catch (Exception e) {
logger.error("Exception getting status from " + wdr); logger.error("Exception getting status from " + wdr);
} }
throw exc;
logger.error(message.toString());
throw new IOException(message.toString());
} }
} }
@ -1174,9 +1195,7 @@ public class ExchangeSession {
} }
} }
xmlDocument.load(builder.build(w3cDocument)); xmlDocument.load(builder.build(w3cDocument));
} catch (IOException ex1) { } catch (Exception ex1) {
logger.error("Exception parsing document", ex1);
} catch (JDOMException ex1) {
logger.error("Exception parsing document", ex1); logger.error("Exception parsing document", ex1);
} }
return xmlDocument; return xmlDocument;

View File

@ -116,7 +116,7 @@ public class XmlDocument {
document = new SAXBuilder().build(stream, dtd); document = new SAXBuilder().build(stream, dtd);
} }
public void load(Document value) throws JDOMException, IOException { public void load(Document value) {
document = value; document = value;
} }

View File

@ -56,7 +56,7 @@ public class ImapConnection extends AbstractConnection {
sendClient(commandId + " OK Authenticated"); sendClient(commandId + " OK Authenticated");
state = AUTHENTICATED; state = AUTHENTICATED;
} catch (Exception e) { } catch (Exception e) {
DavGatewayTray.error("Authentication failed",e); DavGatewayTray.error(e.getMessage());
sendClient(commandId + " NO LOGIN failed"); sendClient(commandId + " NO LOGIN failed");
state = INITIAL; state = INITIAL;
} }
@ -178,7 +178,7 @@ public class ImapConnection extends AbstractConnection {
return result; return result;
} }
public void sendMessage(StringBuffer buffer) throws Exception { public void sendMessage(StringBuffer buffer) {
// TODO implement // TODO implement
} }
} }

View File

@ -101,8 +101,13 @@ public class PopConnection extends AbstractConnection {
sendOK("PASS"); sendOK("PASS");
state = AUTHENTICATED; state = AUTHENTICATED;
} catch (Exception e) { } catch (Exception e) {
DavGatewayTray.error("Authentication failed", e); String message = e.getMessage();
sendERR("authentication failed : " + e + " " + e.getMessage()); if (message == null) {
message = e.toString();
}
DavGatewayTray.error(message);
message = message.replaceAll("\\n", " ");
sendERR("authentication failed : " + message);
} }
} }
} else if ("CAPA".equalsIgnoreCase(command)) { } else if ("CAPA".equalsIgnoreCase(command)) {

View File

@ -65,8 +65,13 @@ public class SmtpConnection extends AbstractConnection {
sendClient("235 OK Authenticated"); sendClient("235 OK Authenticated");
state = AUTHENTICATED; state = AUTHENTICATED;
} catch (Exception e) { } catch (Exception e) {
DavGatewayTray.warn("Authentication failed",e); String message = e.getMessage();
sendClient("554 Authenticated failed"); if (message == null) {
message = e.toString();
}
DavGatewayTray.error(message);
message = message.replaceAll("\\n", " ");
sendClient("554 Authenticated failed " + message);
state = INITIAL; state = INITIAL;
} }
} else { } else {
@ -101,9 +106,9 @@ public class SmtpConnection extends AbstractConnection {
state = AUTHENTICATED; state = AUTHENTICATED;
sendClient("250 Queued mail for delivery"); sendClient("250 Queued mail for delivery");
} catch (Exception e) { } catch (Exception e) {
DavGatewayTray.error("Authentication failed",e); DavGatewayTray.error("Authentication failed", e);
state = AUTHENTICATED; state = AUTHENTICATED;
sendClient("451 Error : " +e+" "+ e.getMessage()); sendClient("451 Error : " + e + " " + e.getMessage());
} }
} else { } else {
@ -121,7 +126,7 @@ public class SmtpConnection extends AbstractConnection {
} catch (IOException e) { } catch (IOException e) {
DavGatewayTray.error(e.getMessage()); DavGatewayTray.error(e.getMessage());
try { try {
sendClient("500 "+e.getMessage()); sendClient("500 " + e.getMessage());
} catch (IOException e2) { } catch (IOException e2) {
DavGatewayTray.debug("Exception sending error to client", e2); DavGatewayTray.debug("Exception sending error to client", e2);
} }
@ -129,14 +134,14 @@ public class SmtpConnection extends AbstractConnection {
try { try {
client.close(); client.close();
} catch (IOException e2) { } catch (IOException e2) {
DavGatewayTray.debug("Exception closing client",e2); DavGatewayTray.debug("Exception closing client", e2);
} }
try { try {
if (session != null) { if (session != null) {
session.close(); session.close();
} }
} catch (IOException e3) { } catch (IOException e3) {
DavGatewayTray.debug("Exception closing gateway",e3); DavGatewayTray.debug("Exception closing gateway", e3);
} }
} }
DavGatewayTray.resetIcon(); DavGatewayTray.resetIcon();