mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
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:
@@ -25,6 +25,7 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.net.SocketException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@@ -364,10 +365,42 @@ public abstract class WebDAVMethod
|
|||||||
}
|
}
|
||||||
else
|
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
|
// Convert error to a server error
|
||||||
|
if (!logOnly)
|
||||||
|
{
|
||||||
throw new WebDAVServerException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);
|
throw new WebDAVServerException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
// Remove temporary file if created
|
// Remove temporary file if created
|
||||||
|
Reference in New Issue
Block a user