camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: CAMEL-9504: OnCompletion - Keep caught exception so it can access the exception
Date Tue, 12 Jan 2016 11:28:55 GMT
Repository: camel
Updated Branches:
  refs/heads/master 4cdedfe3f -> 659664a45


CAMEL-9504: OnCompletion - Keep caught exception so it can access the exception


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7338de18
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7338de18
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7338de18

Branch: refs/heads/master
Commit: 7338de18795ae359aafb2878f45269007629c72c
Parents: 4cdedfe
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Jan 12 11:59:34 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Jan 12 12:28:30 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/processor/OnCompletionProcessor.java  | 5 +----
 .../test/java/org/apache/camel/processor/OnCompletionTest.java  | 1 +
 2 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7338de18/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
b/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
index ad42440..bd06382 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java
@@ -137,9 +137,9 @@ public class OnCompletionProcessor extends ServiceSupport implements AsyncProces
     protected static void doProcess(Processor processor, Exchange exchange) {
         // must remember some properties which we cannot use during onCompletion processing
         // as otherwise we may cause issues
+        // but keep the caused exception stored as a property (Exchange.EXCEPTION_CAUGHT)
on the exchange
         Object stop = exchange.removeProperty(Exchange.ROUTE_STOP);
         Object failureHandled = exchange.removeProperty(Exchange.FAILURE_HANDLED);
-        Object caught = exchange.removeProperty(Exchange.EXCEPTION_CAUGHT);
         Object errorhandlerHandled = exchange.removeProperty(Exchange.ERRORHANDLER_HANDLED);
         Object rollbackOnly = exchange.removeProperty(Exchange.ROLLBACK_ONLY);
         Object rollbackOnlyLast = exchange.removeProperty(Exchange.ROLLBACK_ONLY_LAST);
@@ -159,9 +159,6 @@ public class OnCompletionProcessor extends ServiceSupport implements AsyncProces
             if (failureHandled != null) {
                 exchange.setProperty(Exchange.FAILURE_HANDLED, failureHandled);
             }
-            if (caught != null) {
-                exchange.setProperty(Exchange.EXCEPTION_CAUGHT, caught);
-            }
             if (errorhandlerHandled != null) {
                 exchange.setProperty(Exchange.ERRORHANDLER_HANDLED, errorhandlerHandled);
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/7338de18/camel-core/src/test/java/org/apache/camel/processor/OnCompletionTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/OnCompletionTest.java b/camel-core/src/test/java/org/apache/camel/processor/OnCompletionTest.java
index b29dc26..be4f05e 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/OnCompletionTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/OnCompletionTest.java
@@ -43,6 +43,7 @@ public class OnCompletionTest extends ContextTestSupport {
     public void testSynchronizeFailure() throws Exception {
         getMockEndpoint("mock:sync").expectedMessageCount(1);
         getMockEndpoint("mock:sync").expectedPropertyReceived(Exchange.ON_COMPLETION, true);
+        getMockEndpoint("mock:sync").message(0).exchangeProperty(Exchange.EXCEPTION_CAUGHT).isInstanceOf(IllegalArgumentException.class);
 
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(0);


Mime
View raw message