Skip to content

Commit

Permalink
CAMEL-12075: Polished. This closes #2142
Browse files Browse the repository at this point in the history
  • Loading branch information
davsclaus committed Dec 13, 2017
1 parent ce3036c commit 9b8c3ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Expand Up @@ -353,10 +353,14 @@ public Exchange call() throws Exception {

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
Expand Down
Expand Up @@ -36,7 +36,6 @@ public class SplitterParallelRuntimeExceptionInHasNextOrNext extends ContextTest
*/
@Test
public void testSplitErrorInHasNext() throws Exception {

execute("direct:errorInHasNext");
}

Expand All @@ -46,7 +45,6 @@ public void testSplitErrorInHasNext() throws Exception {
*/
@Test
public void testSplitErrorInNext() throws Exception {

execute("direct:errorInNext");
}

Expand Down Expand Up @@ -79,11 +77,9 @@ protected RouteBuilder createRouteBuilder() throws Exception {
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");

}
};
}
Expand All @@ -109,7 +105,6 @@ static class CustomIterator implements Iterator<String>, Closeable {
private boolean errorInHasNext;

CustomIterator(Exchange exchange, InputStream request, boolean errorInHasNext) {

this.request = request;
this.errorInHasNext = errorInHasNext;

Expand Down

0 comments on commit 9b8c3ba

Please sign in to comment.