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

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git

commit c1186b92a027c2a5b2723fa3a2dd9352c9a562a2
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Mon Jun 7 15:38:58 2021 +0200

    fix(core): remove error handler workaround needed before Camel 3.10
    
    Fixes #657
---
 .../java/org/apache/camel/k/support/SourcesSupport.java     | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git 
a/camel-k-core/support/src/main/java/org/apache/camel/k/support/SourcesSupport.java
 
b/camel-k-core/support/src/main/java/org/apache/camel/k/support/SourcesSupport.java
index 397dcb8..c7c7488 100644
--- 
a/camel-k-core/support/src/main/java/org/apache/camel/k/support/SourcesSupport.java
+++ 
b/camel-k-core/support/src/main/java/org/apache/camel/k/support/SourcesSupport.java
@@ -16,14 +16,12 @@
  */
 package org.apache.camel.k.support;
 
-import java.lang.reflect.Field;
 import java.util.Collection;
 import java.util.List;
 
 import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.builder.ErrorHandlerBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.builder.RouteBuilderLifecycleStrategy;
 import org.apache.camel.k.Runtime;
@@ -174,16 +172,7 @@ public final class SourcesSupport {
     }
 
     static boolean hasErrorHandlerBuilder(RouteBuilder builder) {
-        //return builder.hasErrorHandlerBuilder();
-        // TODO We need to replace the following workaround with the statement 
above once we switch to camel-3.10.0 or above
-        try {
-            Field f = 
RouteBuilder.class.getSuperclass().getDeclaredField("errorHandlerBuilder");
-            f.setAccessible(true);
-            ErrorHandlerBuilder privateErrorHandlerBuilder = 
(ErrorHandlerBuilder) f.get(builder);
-            return privateErrorHandlerBuilder != null;
-        } catch (Exception e) {
-            throw new IllegalArgumentException("Something went wrong while 
checking the error handler builder", e);
-        }
+        return builder.hasErrorHandlerBuilder();
     }
 
     public static void loadErrorHandlerSource(Runtime runtime, 
SourceDefinition errorHandlerSourceDefinition) {

Reply via email to