You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2010/07/12 14:08:14 UTC

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

Author: gnodet
Date: Mon Jul 12 12:08:13 2010
New Revision: 963251

URL: http://svn.apache.org/viewvc?rev=963251&view=rev
Log:
SMXCOMP-778: Possible NPE during http timeouts

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

Modified: servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java?rev=963251&r1=963250&r2=963251&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java (original)
+++ servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java Mon Jul 12 12:08:13 2010
@@ -233,6 +233,9 @@ public class HttpConsumerEndpoint extend
     // which would mean it has timed out.  If this is the case, throw an exception
     // that will set the exchange status to ERROR.
     Continuation cont = locks.get(exchange.getExchangeId());
+    if (cont == null) {
+      throw new Exception("HTTP request has timed out for exchange: " + exchange.getExchangeId());
+    }
     synchronized (cont) {
       if (logger.isDebugEnabled()) {
         logger.debug("Resuming continuation for exchange: " + exchange.getExchangeId());
@@ -241,6 +244,12 @@ public class HttpConsumerEndpoint extend
       cont.setObject(exchange);
       // Resume continuation
       cont.resume();
+      if (!cont.isResumed()) {
+        if (logger.isDebugEnabled()) {
+          logger.debug("Could not resume continuation for exchange: " + exchange.getExchangeId());
+        }
+        throw new Exception("HTTP request has timed out for exchange: " + exchange.getExchangeId());
+      }
     }
   }