Skip to content

Commit

Permalink
fix(core): remove error handler workaround needed before Camel 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
squakez authored and orpiske committed Jun 18, 2021
1 parent dc0b143 commit f8c956a
Showing 1 changed file with 1 addition and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -174,16 +172,7 @@ public void afterConfigure(RouteBuilder builder) {
}

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) {
Expand Down

0 comments on commit f8c956a

Please sign in to comment.