Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,8 @@ public OnExceptionDefinition onException(Class<? extends Throwable> exception) {
* @param exceptions list of exceptions to catch
* @return the builder
*/
public OnExceptionDefinition onException(Class<? extends Throwable>... exceptions) {
@SafeVarargs
public final OnExceptionDefinition onException(Class<? extends Throwable>... exceptions) {
OnExceptionDefinition last = null;
for (Class<? extends Throwable> ex : exceptions) {
last = last == null ? onException(ex) : last.onException(ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,49 @@ public void setExceptionClasses(List<Class<? extends Throwable>> exceptionClasse
// Fluent API
// -------------------------------------------------------------------------

/**
* The exception(s) to catch.
*
* @param exception one or more exceptions
* @return the builder
*/
public CatchDefinition exception(Class<? extends Throwable> exception) {
return exception(List.of(exception));
}

/**
* The exception(s) to catch.
*
* @param exception1 fist exception
* @param exception2 second exception
* @return the builder
*/
public CatchDefinition exception(Class<? extends Throwable> exception1, Class<? extends Throwable> exception2) {
return exception(List.of(exception1, exception2));
}

/**
* The exception(s) to catch.
*
* @param exception1 fist exception
* @param exception2 second exception
* @param exception3 third exception
* @return the builder
*/
public CatchDefinition exception(
Class<? extends Throwable> exception1, Class<? extends Throwable> exception2,
Class<? extends Throwable> exception3) {
return exception(List.of(exception1, exception2, exception3));
}

/**
* The exception(s) to catch.
*
* @param exceptions one or more exceptions
* @return the builder
*/
public CatchDefinition exception(Class<? extends Throwable>... exceptions) {
@SafeVarargs
public final CatchDefinition exception(Class<? extends Throwable>... exceptions) {
return exception(List.of(exceptions));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2088,14 +2088,47 @@ public OnExceptionDefinition onException(Class<? extends Throwable> exceptionTyp
return answer;
}

/**
* <a href="http://camel.apache.org/exception-clause.html">Exception clause</a> for catching certain exceptions and
* handling them.
*
* @param exceptionType1 the first exception to catch
* @param exceptionType2 the second exception to catch
* @return the exception builder to configure
*/
public OnExceptionDefinition onException(
Class<? extends Throwable> exceptionType1, Class<? extends Throwable> exceptionType2) {
OnExceptionDefinition answer = new OnExceptionDefinition(Arrays.asList(exceptionType1, exceptionType2));
addOutput(answer);
return answer;
}

/**
* <a href="http://camel.apache.org/exception-clause.html">Exception clause</a> for catching certain exceptions and
* handling them.
*
* @param exceptionType1 the first exception to catch
* @param exceptionType2 the second exception to catch
* @param exceptionType3 the third exception to catch
* @return the exception builder to configure
*/
public OnExceptionDefinition onException(
Class<? extends Throwable> exceptionType1, Class<? extends Throwable> exceptionType2,
Class<? extends Throwable> exceptionType3) {
OnExceptionDefinition answer = new OnExceptionDefinition(Arrays.asList(exceptionType1, exceptionType2, exceptionType3));
addOutput(answer);
return answer;
}

/**
* <a href="http://camel.apache.org/exception-clause.html">Exception clause</a> for catching certain exceptions and
* handling them.
*
* @param exceptions list of exceptions to catch
* @return the exception builder to configure
*/
public OnExceptionDefinition onException(Class<? extends Throwable>... exceptions) {
@SafeVarargs
public final OnExceptionDefinition onException(Class<? extends Throwable>... exceptions) {
OnExceptionDefinition answer = new OnExceptionDefinition(Arrays.asList(exceptions));
addOutput(answer);
return answer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ public OnExceptionDefinition onException(Class<? extends Throwable> exceptionTyp
* @param exceptions list of exceptions to catch
* @return the exception builder to configure
*/
public OnExceptionDefinition onException(Class<? extends Throwable>... exceptions) {
@SafeVarargs
public final OnExceptionDefinition onException(Class<? extends Throwable>... exceptions) {
OnExceptionDefinition answer = new OnExceptionDefinition(Arrays.asList(exceptions));
answer.setRouteConfiguration(this);
onExceptions.add(answer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ public abstract class AbstractApiComponent<E extends Enum<E> & ApiName, T, S ext
/**
* Deprecated constructor for AbstractApiComponent.
*
* @deprecated Use {@link AbstractApiComponent#AbstractApiComponent(Class, ApiCollection)}
* @param endpointClass This is deprecated. Do not use
* @param apiNameClass The API name class
* @param collection The collection of API methods
* @deprecated Use {@link AbstractApiComponent#AbstractApiComponent(Class, ApiCollection)}
* @param endpointClass This is deprecated. Do not use
* @param apiNameClass The API name class
* @param collection The collection of API methods
*/
@Deprecated
public AbstractApiComponent(Class<? extends Endpoint> endpointClass, Class<E> apiNameClass, S collection) {
Expand All @@ -61,21 +61,25 @@ public AbstractApiComponent(Class<? extends Endpoint> endpointClass, Class<E> ap
/**
* Deprecated constructor for AbstractApiComponent.
*
* @deprecated Use {@link AbstractApiComponent#AbstractApiComponent(CamelContext, Class, ApiCollection)} instead
* @param context The CamelContext
* @param endpointClass This is deprecated. Do not use
* @param apiNameClass The API name class
* @param collection The collection of API methods
* @deprecated Use
* {@link AbstractApiComponent#AbstractApiComponent(CamelContext, Class, ApiCollection)}
* instead
* @param context The CamelContext
* @param endpointClass This is deprecated. Do not use
* @param apiNameClass The API name class
* @param collection The collection of API methods
*/
@Deprecated
public AbstractApiComponent(CamelContext context, Class<? extends Endpoint> endpointClass, Class<E> apiNameClass, S collection) {
public AbstractApiComponent(CamelContext context, Class<? extends Endpoint> endpointClass, Class<E> apiNameClass,
S collection) {
this(context, apiNameClass, collection);
}

/**
* Creates a new AbstractApiComponent
*
* @param apiNameClass The API name class
* @param collection The collection of API methods
* @param collection The collection of API methods
*/
protected AbstractApiComponent(Class<E> apiNameClass, S collection) {
this.collection = collection;
Expand All @@ -84,9 +88,10 @@ protected AbstractApiComponent(Class<E> apiNameClass, S collection) {

/**
* Creates a new AbstractApiComponent
* @param context The CamelContext
*
* @param context The CamelContext
* @param apiNameClass The API name class
* @param collection The collection of API methods
* @param collection The collection of API methods
*/
protected AbstractApiComponent(CamelContext context, Class<E> apiNameClass, S collection) {
super(context);
Expand Down