You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/11/17 08:01:55 UTC

svn commit: r881175 - /camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java

Author: davsclaus
Date: Tue Nov 17 07:01:54 2009
New Revision: 881175

URL: http://svn.apache.org/viewvc?rev=881175&view=rev
Log:
CAMEL-2180: Do not use copy of exchange when processing in doCatch.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java?rev=881175&r1=881174&r2=881175&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java Tue Nov 17 07:01:54 2009
@@ -72,7 +72,7 @@
             exchange.setException(e);
         }
 
-        // handle any exception occured during the try processor
+        // handle any exception occurred during the try processor
         try {
             if (e != null) {
                 handleException(exchange, e);
@@ -104,17 +104,14 @@
                     LOG.trace("This TryProcessor catches the exception: " + caught.getClass().getName() + " caused by: " + e.getMessage());
                 }
 
-                // TODO: No need to make a copy
-                // lets attach the exception to the exchange
-                Exchange localExchange = exchange.copy();
-                
-                localExchange.setProperty(Exchange.EXCEPTION_CAUGHT, caught);
                 // give the rest of the pipeline another chance
-                localExchange.setException(null);
+                exchange.setProperty(Exchange.EXCEPTION_CAUGHT, caught);
+                exchange.setException(null);
 
                 // do not catch any exception here, let it propagate up
-                catchClause.process(localExchange);
+                catchClause.process(exchange);
 
+                // is the exception handled by the catch clause
                 boolean handled = catchClause.handles(exchange);
 
                 if (LOG.isDebugEnabled()) {
@@ -124,13 +121,11 @@
 
                 if (!handled) {
                     // put exception back as it was not handled
-                    if (localExchange.getException() == null) {
-                        localExchange.setException(localExchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class));
+                    if (exchange.getException() == null) {
+                        exchange.setException(exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class));
                     }
                 }
 
-                // copy result back to the original exchange
-                ExchangeHelper.copyResults(exchange, localExchange);
                 return;
             }
         }