You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ja...@apache.org on 2013/02/06 14:59:11 UTC

svn commit: r1442965 - /servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java

Author: janstey
Date: Wed Feb  6 13:59:10 2013
New Revision: 1442965

URL: http://svn.apache.org/viewvc?rev=1442965&view=rev
Log:
SMXCOMP-965 - HttpConsumerEndpoint invokes sendError with null exchange

Modified:
    servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java

Modified: servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java?rev=1442965&r1=1442964&r2=1442965&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java Wed Feb  6 13:59:10 2013
@@ -330,11 +330,12 @@ public class HttpConsumerEndpoint extend
      *   (either because the exchange was received or because the request timed out)
      */
     public void process(HttpServletRequest request, HttpServletResponse response) throws Exception {
-        MessageExchange exchange;
+        MessageExchange exchange = null;
         Continuation continuation = null;
         Object mutex = null;
         String id = null;
-
+        boolean wasCleaned = false;
+        
         try {
             // Handle WSDLs, XSDs
             if (handleStaticResource(request, response)) {
@@ -392,9 +393,13 @@ public class HttpConsumerEndpoint extend
             // message exchange has been completed, so we're ready to send back an HTTP response now
             logger.debug("Resuming HTTP request: {}", request);
             doClean(mutex, continuation, id);
+            wasCleaned = true;
             handleResponse(exchange, request, response);
         } catch (Exception e) {
-            sendError(doClean(mutex, continuation, id), e, request, response);
+            if (!wasCleaned) {
+                exchange = doClean(mutex, continuation, id);
+            }
+            sendError(exchange, e, request, response);
         }
     }