From e8cfcb57ffef3d68cc23b28f7da3eb0b3f69b18f Mon Sep 17 00:00:00 2001 From: mguessan Date: Tue, 13 Sep 2011 07:51:21 +0000 Subject: [PATCH] Do not always log stacktrace in handleNetworkDown git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1786 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/exchange/ExchangeSessionFactory.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/java/davmail/exchange/ExchangeSessionFactory.java b/src/java/davmail/exchange/ExchangeSessionFactory.java index cae84481..2a892ef7 100644 --- a/src/java/davmail/exchange/ExchangeSessionFactory.java +++ b/src/java/davmail/exchange/ExchangeSessionFactory.java @@ -33,6 +33,7 @@ import org.apache.commons.httpclient.methods.GetMethod; import java.io.IOException; import java.net.NetworkInterface; import java.net.SocketException; +import java.net.UnknownHostException; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; @@ -235,7 +236,10 @@ public final class ExchangeSessionFactory { private static void handleNetworkDown(Exception exc) throws DavMailException { if (!checkNetwork() || configChecked) { ExchangeSession.LOGGER.warn(BundleMessage.formatLog("EXCEPTION_NETWORK_DOWN")); - ExchangeSession.LOGGER.debug(exc, exc); + // log full stack trace for unknown errors + if (!(exc instanceof UnknownHostException)) { + ExchangeSession.LOGGER.debug(exc, exc); + } throw new NetworkDownException("EXCEPTION_NETWORK_DOWN"); } else { BundleMessage message = new BundleMessage("EXCEPTION_CONNECT", exc.getClass().getName(), exc.getMessage());