Author: jacopoc
Date: Wed Jun 20 09:15:08 2012
New Revision: 1352001
URL: http://svn.apache.org/viewvc?rev=1352001&view=rev
Log:
Applied fix from trunk for revision: 1351999
===
When an IOException error happens while communicating with the browser (for
example when the user closes the browser window before the page is returned)
there is no need to attempt to render the error page; this was causing two
error stack traces in the logs every time a connection was aborted; improved
logging for this event.
Modified:
ofbiz/branches/release12.04/ (props changed)
ofbiz/branches/release12.04/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java
Propchange: ofbiz/branches/release12.04/
------------------------------------------------------------------------------
Merged /ofbiz/trunk:r1351999
Modified:
ofbiz/branches/release12.04/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java?rev=1352001&r1=1352000&r2=1352001&view=diff
==============================================================================
---
ofbiz/branches/release12.04/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java
(original)
+++
ofbiz/branches/release12.04/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java
Wed Jun 20 09:15:08 2012
@@ -224,10 +224,17 @@ public class ControlServlet extends Http
requestHandler.doRequest(request, response, null, userLogin,
delegator);
} catch (RequestHandlerException e) {
Throwable throwable = e.getNested() != null ? e.getNested() : e;
- Debug.logError(throwable, "Error in request handler: ", module);
- StringUtil.HtmlEncoder encoder = new StringUtil.HtmlEncoder();
- request.setAttribute("_ERROR_MESSAGE_",
encoder.encode(throwable.toString()));
- errorPage = requestHandler.getDefaultErrorPage(request);
+ if (throwable instanceof IOException) {
+ // when an IOException occurs (most of the times caused by the
browser window being closed before the request is completed)
+ // the connection with the browser is lost and so there is no
need to serve the error page; a message is logged to record the event
+ if (Debug.warningOn()) Debug.logWarning("Communication error
with the client while processing the request: " +
request.getAttribute("_CONTROL_PATH_") + request.getPathInfo(), module);
+ if (Debug.verboseOn()) Debug.logVerbose(throwable, module);
+ } else {
+ Debug.logError(throwable, "Error in request handler: ",
module);
+ StringUtil.HtmlEncoder encoder = new StringUtil.HtmlEncoder();
+ request.setAttribute("_ERROR_MESSAGE_",
encoder.encode(throwable.toString()));
+ errorPage = requestHandler.getDefaultErrorPage(request);
+ }
} catch (Exception e) {
Debug.logError(e, "Error in request handler: ", module);
StringUtil.HtmlEncoder encoder = new StringUtil.HtmlEncoder();