You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ro...@apache.org on 2009/02/25 16:30:42 UTC
svn commit: r747824 - in /camel/trunk/camel-core/src:
main/java/org/apache/camel/processor/TryProcessor.java
test/java/org/apache/camel/processor/TryProcessorHandleTest.java
Author: romkal
Date: Wed Feb 25 15:30:41 2009
New Revision: 747824
URL: http://svn.apache.org/viewvc?rev=747824&view=rev
Log:
CAMEL-1356: Exception handled in tryBlock() is stored as exchange property using standard property name from Exchange class
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TryProcessorHandleTest.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=747824&r1=747823&r2=747824&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 Wed Feb 25 15:30:41 2009
@@ -16,6 +16,8 @@
*/
package org.apache.camel.processor;
+import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
+
import java.util.List;
import org.apache.camel.Exchange;
@@ -26,8 +28,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
-
/**
* Implements try/catch/finally type processing
*
@@ -109,13 +109,14 @@
if (catchClause.catches(e)) {
// lets attach the exception to the exchange
Exchange localExchange = exchange.copy();
- localExchange.getIn().setHeader("caught.exception", e);
+
+ localExchange.setProperty(Exchange.EXCEPTION_CAUGHT, e);
// give the rest of the pipeline another chance
localExchange.setException(null);
// do not catch any exception here, let it propagate up
catchClause.process(localExchange);
- localExchange.getIn().removeHeader("caught.exception");
+ localExchange.removeProperty(Exchange.EXCEPTION_CAUGHT);
ExchangeHelper.copyResults(exchange, localExchange);
return;
}
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TryProcessorHandleTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TryProcessorHandleTest.java?rev=747824&r1=747823&r2=747824&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TryProcessorHandleTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TryProcessorHandleTest.java Wed Feb 25 15:30:41 2009
@@ -63,7 +63,7 @@
assertEquals("Should not be marked as failed", false, exchange.isFailed());
- Exception e = (Exception)exchange.getIn().getHeader("caught.exception");
+ Exception e = (Exception)exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
assertNotNull("There should be an exception", e);
assertTrue(e instanceof IllegalStateException);
assertEquals("Force to fail", e.getMessage());