From commits-return-72903-archive-asf-public=cust-asf.ponee.io@camel.apache.org Tue May 28 21:56:56 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id BE5B4180771 for ; Tue, 28 May 2019 23:56:55 +0200 (CEST) Received: (qmail 40056 invoked by uid 500); 28 May 2019 21:56:55 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 39908 invoked by uid 99); 28 May 2019 21:56:54 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 May 2019 21:56:54 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id B43CB8A134; Tue, 28 May 2019 21:56:54 +0000 (UTC) Date: Tue, 28 May 2019 21:56:57 +0000 To: "commits@camel.apache.org" Subject: [camel] 04/07: [CAMEL-13564] Remove redundant error handler configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: gnodet@apache.org In-Reply-To: <155908061328.32109.3823609197402593983@gitbox.apache.org> References: <155908061328.32109.3823609197402593983@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: camel X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Rev: c12994378526496eb7f3e61a33d588dd76abc41b X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20190528215654.B43CB8A134@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git commit c12994378526496eb7f3e61a33d588dd76abc41b Author: Guillaume Nodet AuthorDate: Tue May 28 11:19:49 2019 +0200 [CAMEL-13564] Remove redundant error handler configuration --- .../cdi/transaction/JtaTransactionPolicy.java | 3 --- .../camel/spring/spi/SpringTransactionPolicy.java | 6 ------ .../apache/camel/builder/ErrorHandlerBuilder.java | 23 ---------------------- .../camel/builder/ErrorHandlerBuilderSupport.java | 15 ++++++++++++++ .../apache/camel/reifier/DynamicRouterReifier.java | 1 - 5 files changed, 15 insertions(+), 33 deletions(-) diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionPolicy.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionPolicy.java index e0e6c46..e639526 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionPolicy.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionPolicy.java @@ -116,9 +116,6 @@ public abstract class JtaTransactionPolicy implements TransactedPolicy { } answer = createTransactionErrorHandler(routeContext, processor, txBuilder); - answer.setExceptionPolicy(txBuilder.getExceptionPolicyStrategy()); - // configure our answer based on the existing error handler - txBuilder.configure(routeContext, answer); // set the route to use our transacted error handler builder route.setErrorHandlerFactory(txBuilder); diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java index a35f9b2..982b932 100644 --- a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java +++ b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java @@ -90,9 +90,6 @@ public class SpringTransactionPolicy implements TransactedPolicy { // already a TX error handler then we are good to go LOG.debug("The ErrorHandlerBuilder configured is already a TransactionErrorHandlerBuilder: {}", builder); answer = createTransactionErrorHandler(routeContext, processor, builder); - answer.setExceptionPolicy(builder.getExceptionPolicyStrategy()); - // configure our answer based on the existing error handler - builder.configure(routeContext, answer); } else { // no transaction error handler builder configure so create a temporary one as we got all // the needed information form the configured builder anyway this allow us to use transacted @@ -110,9 +107,6 @@ public class SpringTransactionPolicy implements TransactedPolicy { txBuilder.setErrorHandlers(routeContext, builder.getErrorHandlers(routeContext)); } answer = createTransactionErrorHandler(routeContext, processor, txBuilder); - answer.setExceptionPolicy(txBuilder.getExceptionPolicyStrategy()); - // configure our answer based on the existing error handler - txBuilder.configure(routeContext, answer); // set the route to use our transacted error handler builder route.setErrorHandlerFactory(txBuilder); diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilder.java b/core/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilder.java index e4c87a8..e814dba 100644 --- a/core/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilder.java +++ b/core/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilder.java @@ -20,8 +20,6 @@ import java.util.List; import org.apache.camel.ErrorHandlerFactory; import org.apache.camel.model.OnExceptionDefinition; -import org.apache.camel.processor.ErrorHandler; -import org.apache.camel.processor.errorhandler.ExceptionPolicyStrategy; import org.apache.camel.spi.RouteContext; /** @@ -53,32 +51,11 @@ public interface ErrorHandlerBuilder extends ErrorHandlerFactory { List getErrorHandlers(RouteContext routeContext); /** - * Gets the exception policy strategy - */ - ExceptionPolicyStrategy getExceptionPolicyStrategy(); - - /** - * Sets the exception policy strategy to use for resolving the {@link org.apache.camel.model.OnExceptionDefinition} - * to use for a given thrown exception - * - * @param exceptionPolicyStrategy the exception policy strategy - */ - void setExceptionPolicyStrategy(ExceptionPolicyStrategy exceptionPolicyStrategy); - - /** * Whether this error handler supports transacted exchanges. */ boolean supportTransacted(); /** - * Configures the other error handler based on this error handler. - * - * @param routeContext the route context - * @param handler the other error handler - */ - void configure(RouteContext routeContext, ErrorHandler handler); - - /** * Clones this builder so each {@link RouteBuilder} has its private builder * to use, to avoid changes from one {@link RouteBuilder} to influence the * others. diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderSupport.java b/core/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderSupport.java index a0e86e2..8e60a61 100644 --- a/core/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderSupport.java +++ b/core/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderSupport.java @@ -60,6 +60,12 @@ public abstract class ErrorHandlerBuilderSupport implements ErrorHandlerBuilder other.exceptionPolicyStrategy = exceptionPolicyStrategy; } + /** + * Configures the other error handler based on this error handler. + * + * @param routeContext the route context + * @param handler the other error handler + */ public void configure(RouteContext routeContext, ErrorHandler handler) { if (handler instanceof ErrorHandlerSupport) { ErrorHandlerSupport handlerSupport = (ErrorHandlerSupport) handler; @@ -142,10 +148,19 @@ public abstract class ErrorHandlerBuilderSupport implements ErrorHandlerBuilder return this; } + /** + * Gets the exception policy strategy + */ public ExceptionPolicyStrategy getExceptionPolicyStrategy() { return exceptionPolicyStrategy; } + /** + * Sets the exception policy strategy to use for resolving the {@link org.apache.camel.model.OnExceptionDefinition} + * to use for a given thrown exception + * + * @param exceptionPolicyStrategy the exception policy strategy + */ public void setExceptionPolicyStrategy(ExceptionPolicyStrategy exceptionPolicyStrategy) { ObjectHelper.notNull(exceptionPolicyStrategy, "ExceptionPolicyStrategy"); this.exceptionPolicyStrategy = exceptionPolicyStrategy; diff --git a/core/camel-core/src/main/java/org/apache/camel/reifier/DynamicRouterReifier.java b/core/camel-core/src/main/java/org/apache/camel/reifier/DynamicRouterReifier.java index 557e291..a0d8acf 100644 --- a/core/camel-core/src/main/java/org/apache/camel/reifier/DynamicRouterReifier.java +++ b/core/camel-core/src/main/java/org/apache/camel/reifier/DynamicRouterReifier.java @@ -22,7 +22,6 @@ import org.apache.camel.Expression; import org.apache.camel.Processor; import org.apache.camel.model.DynamicRouterDefinition; import org.apache.camel.model.ProcessorDefinition; -import org.apache.camel.model.RouteDefinition; import org.apache.camel.processor.DynamicRouter; import org.apache.camel.reifier.errorhandler.ErrorHandlerReifier; import org.apache.camel.spi.RouteContext;