camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r658395 - /activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DebugInterceptor.java
Date Tue, 20 May 2008 18:57:11 GMT
Author: jstrachan
Date: Tue May 20 11:57:10 2008
New Revision: 658395

URL: http://svn.apache.org/viewvc?rev=658395&view=rev
Log:
copy the exchanges stored in the watch lists

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DebugInterceptor.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DebugInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DebugInterceptor.java?rev=658395&r1=658394&r2=658395&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DebugInterceptor.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DebugInterceptor.java
Tue May 20 11:57:10 2008
@@ -23,6 +23,7 @@
 import org.apache.camel.Processor;
 import org.apache.camel.Exchange;
 import org.apache.camel.Predicate;
+import org.apache.camel.Message;
 
 /**
  * An interceptor for debugging and tracing routes
@@ -89,10 +90,23 @@
      */
     protected void addTraceExchange(Exchange exchange) {
         if (shouldTraceExchange(exchange)) {
-            exchanges.add(exchange);
+            exchanges.add(copyExchange(exchange));
         }
     }
 
+    protected Exchange copyExchange(Exchange previousExchange) {
+        Exchange answer = previousExchange.newInstance();
+        answer.getProperties().putAll(previousExchange.getProperties());
+        answer.getIn().copyFrom(previousExchange.getIn());
+
+        // only copy the out if its defined
+        Message previousOut = previousExchange.getOut(false);
+        if (previousOut != null) {
+            answer.getOut().copyFrom(previousOut);
+        }
+        return answer;
+    }
+
     /**
      * Returns true if the given exchange should be logged in the trace list
      */



Mime
View raw message