WebDAV: don't show stack traces for ClientAbortException (SocketException) errors.

When mounting WebDAV as a drive on Mac OS X (using finder) many ClientAbortException errors are raised. This appears to be due to the Mac dropping connections whilst the WebDAV handler is still trying to stream content back to the WebDAV client.

Stack traces are now suppressed for DEBUG-level logging, however full stack traces may still be obtained by switching to TRACE for alfresco.webdav.protocol



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@35635 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2012-04-24 15:57:35 +00:00
parent ad219e4682
commit f7e9040218

View File

@@ -25,6 +25,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.SocketException;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
@@ -364,8 +365,40 @@ public abstract class WebDAVMethod
}
else
{
boolean logOnly = false;
Throwable t = e;
while ((t = t.getCause()) != null)
{
if (t instanceof SocketException)
{
logOnly = true;
// The client aborted the connection - we can't do much about this, except log it.
if (logger.isTraceEnabled() || logger.isDebugEnabled())
{
String message = "Client dropped connection [uri=" + m_request.getRequestURI() + "]";
if (logger.isTraceEnabled())
{
// Include a stack trace when trace is enabled.
logger.trace(message, e);
}
else if (logger.isDebugEnabled())
{
// Just a message for debug-level output.
logger.debug(message);
}
}
break;
}
}
// Convert error to a server error
throw new WebDAVServerException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);
if (!logOnly)
{
throw new WebDAVServerException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);
}
}
}
finally