camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [camel] 04/07: [CAMEL-13564] Remove redundant error handler configuration
Date Tue, 28 May 2019 21:56:57 GMT
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 <gnodet@gmail.com>
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<OnExceptionDefinition> 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;


Mime
View raw message