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 2017/12/13 09:15:56 UTC

[camel] 04/04: CAMEL-12075: Polished. This closes #2142

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-2.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a6d5e1bcf36bfae73aa510a3416f4dc0ef293327
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Dec 13 09:53:05 2017 +0100

    CAMEL-12075: Polished. This closes #2142
---
 .../main/java/org/apache/camel/processor/MulticastProcessor.java  | 8 ++++++--
 .../issues/SplitterParallelRuntimeExceptionInHasNextOrNext.java   | 5 -----
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
index 90a6f7b..b16c8e1 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
@@ -353,10 +353,14 @@ public class MulticastProcessor extends ServiceSupport implements AsyncProcessor
     
                     total.incrementAndGet();
                 }
-            } catch (RuntimeException e) {
+            } catch (Throwable e) {
                 // The methods it.hasNext and it.next can throw RuntimeExceptions when custom iterators are implemented.
                 // We have to catch the exception here otherwise the aggregator threads would pile up.
-                executionException.set(e);
+                if (e instanceof Exception) {
+                    executionException.set((Exception) e);
+                } else {
+                    executionException.set(ObjectHelper.wrapRuntimeCamelException(e));
+                }
             }
 
             // signal all tasks has been submitted
diff --git a/camel-core/src/test/java/org/apache/camel/issues/SplitterParallelRuntimeExceptionInHasNextOrNext.java b/camel-core/src/test/java/org/apache/camel/issues/SplitterParallelRuntimeExceptionInHasNextOrNext.java
index 948aada..5eeafd2 100644
--- a/camel-core/src/test/java/org/apache/camel/issues/SplitterParallelRuntimeExceptionInHasNextOrNext.java
+++ b/camel-core/src/test/java/org/apache/camel/issues/SplitterParallelRuntimeExceptionInHasNextOrNext.java
@@ -36,7 +36,6 @@ public class SplitterParallelRuntimeExceptionInHasNextOrNext extends ContextTest
      */
     @Test
     public void testSplitErrorInHasNext() throws Exception {
-
         execute("direct:errorInHasNext");
     }
 
@@ -46,7 +45,6 @@ public class SplitterParallelRuntimeExceptionInHasNextOrNext extends ContextTest
      */
     @Test
     public void testSplitErrorInNext() throws Exception {
-
         execute("direct:errorInNext");
     }
 
@@ -79,11 +77,9 @@ public class SplitterParallelRuntimeExceptionInHasNextOrNext extends ContextTest
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-
                 from("direct:errorInHasNext").split().method(SplitterImpl.class, "errorInHasNext").streaming().parallelProcessing(true).to("mock:split1");
 
                 from("direct:errorInNext").split().method(SplitterImpl.class, "errorInNext").streaming().parallelProcessing(true).to("mock:split2");
-
             }
         };
     }
@@ -109,7 +105,6 @@ public class SplitterParallelRuntimeExceptionInHasNextOrNext extends ContextTest
         private boolean errorInHasNext;
 
         CustomIterator(Exchange exchange, InputStream request, boolean errorInHasNext) {
-
             this.request = request;
             this.errorInHasNext = errorInHasNext;
 

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.