ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1574940 - in /ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet: AceRestException.java AgentDeploymentServlet.java DeploymentServlet.java
Date Thu, 06 Mar 2014 16:04:12 GMT
Author: jawi
Date: Thu Mar  6 16:04:12 2014
New Revision: 1574940

URL: http://svn.apache.org/r1574940
Log:
ACE-249 - properly handle exceptions during streaming:

- when a AceRestException cannot propagate a given exception to the calling
  side, make sure to log it on the server as a last resort to get some clue
  as to why things are failing.


Modified:
    ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AceRestException.java
    ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java
    ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java

Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AceRestException.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AceRestException.java?rev=1574940&r1=1574939&r2=1574940&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AceRestException.java
(original)
+++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AceRestException.java
Thu Mar  6 16:04:12 2014
@@ -19,6 +19,7 @@
 package org.apache.ace.deployment.servlet;
 
 import java.io.IOException;
+
 import javax.servlet.http.HttpServletResponse;
 
 /**
@@ -40,7 +41,12 @@ public class AceRestException extends Ex
      *
      * @param response
      */
-    public void handleAsHttpError(HttpServletResponse response) throws IOException {
-        response.sendError(m_statusCode, m_description);
+    public boolean handleAsHttpError(HttpServletResponse response) throws IOException {
+        if (!response.isCommitted()) {
+            response.reset();
+            response.sendError(m_statusCode, m_description);
+            return true;
+        }
+        return false;
     }
 }
\ No newline at end of file

Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java?rev=1574940&r1=1574939&r2=1574940&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java
(original)
+++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java
Thu Mar  6 16:04:12 2014
@@ -143,7 +143,9 @@ public class AgentDeploymentServlet exte
         }
         catch (AceRestException e) {
             m_log.log(LogService.LOG_WARNING, e.getMessage(), e);
-            e.handleAsHttpError(response);
+            if (!e.handleAsHttpError(response)) {
+                m_log.log(LogService.LOG_ERROR, "Failed to properly notify client of exception!",
e);
+            }
         }
     }
 

Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java?rev=1574940&r1=1574939&r2=1574940&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java
(original)
+++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java
Thu Mar  6 16:04:12 2014
@@ -148,7 +148,9 @@ public class DeploymentServlet extends H
         }
         catch (AceRestException e) {
             m_log.log(LogService.LOG_WARNING, e.getMessage(), e);
-            e.handleAsHttpError(response);
+            if (!e.handleAsHttpError(response)) {
+                m_log.log(LogService.LOG_ERROR, "Failed to properly notify client of exception!",
e);
+            }
         }
         catch (OverloadedException oe) {
             throw new ServletException(oe);
@@ -178,7 +180,9 @@ public class DeploymentServlet extends H
         }
         catch (AceRestException e) {
             m_log.log(LogService.LOG_WARNING, e.getMessage(), e);
-            e.handleAsHttpError(response);
+            if (!e.handleAsHttpError(response)) {
+                m_log.log(LogService.LOG_ERROR, "Failed to properly notify client of exception!",
e);
+            }
         }
         catch (OverloadedException oe) {
             throw new ServletException(oe);



Mime
View raw message