[
https://issues.apache.org/jira/browse/CAMEL-22874?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Bjorn Beskow updated CAMEL-22874:
---------------------------------
Description:
Starting with 4.14.3, a defined error handler in a route which uses a
rest-openapi endpoint gets invokes twice (which of course is annoying with
duplicate logs but can also cause more severe problems if the error handling
have side effects besides logging).
The simplest way I found to reproduce the error was using the
camel-spring-boot-examples/openapi-contract-first project:
Add an error handler to the PetStoreRoute, which produces a log:
{code:java}
onException(Exception.class)
.log("Error processing request: ${exception.message}")
.handled(false); {code}
Modify the GET route to throw an exception:
{code:java}
from("direct:getPetById")
.process(e -> {
throw new RuntimeException("Simulated error get pet");
});
{code}
Start the application with spring-boot:run, then trigger the endpoint:
{code:java}
curl http://0.0.0.0:8080/myapp/myapi/pet/123 {code}
The log statement of the exception handler shows up twice (as well as the
Failed delivery logging).
The problem seem to have started with version 4.14.3 (4.14.2 does not show this
behavior).
I have tried to debug the problem, but have too narrow knowledge about the code
base to be of any help (sorry!)
was:
Starting with 4.14.3, a defined error handler in a route which uses a
rest-openapi endpoint gets invokes twice (which of course is annoying with
duplicate logs but can also cause more severe problems if the error handling
have side effects besides logging).
The simplest way I found to reproduce the error was using the
camel-spring-boot-examples/openapi-contract-first project:
Add an error handler to the PetStoreRoute, which produces a log:
{code:java}
onException(Exception.class)
.log("Error processing request: ${exception.message}")
.handled(false); {code}
Modify the GET route to throw an exception:
{code:java}
from("direct:getPetById")
.process(e -> {
throw new RuntimeException("Simulated error get pet");
});
{code}
Start the application with spring-boot:run, then trigger the endpoint:
{code:java}
curl http://0.0.0.0:8080/myapp/myapi/pet/123 {code}
The log statement of the exception handler shows up twice (as well as the
Failed delivery logging).
The problem seem to have started with version 4.14.3 (4.14.2 does not show this
behavior).
I have tried to debug the problem, but have to narrow knowledge about the code
base to be of any help (sorry!)
> Error handler in camel-rest-openapi route is invoked twice
> ----------------------------------------------------------
>
> Key: CAMEL-22874
> URL: https://issues.apache.org/jira/browse/CAMEL-22874
> Project: Camel
> Issue Type: Bug
> Components: camel-rest-openapi
> Affects Versions: 4.14.3, 4.17.0
> Reporter: Bjorn Beskow
> Priority: Minor
>
> Starting with 4.14.3, a defined error handler in a route which uses a
> rest-openapi endpoint gets invokes twice (which of course is annoying with
> duplicate logs but can also cause more severe problems if the error handling
> have side effects besides logging).
>
> The simplest way I found to reproduce the error was using the
> camel-spring-boot-examples/openapi-contract-first project:
> Add an error handler to the PetStoreRoute, which produces a log:
>
> {code:java}
> onException(Exception.class)
> .log("Error processing request: ${exception.message}")
> .handled(false); {code}
>
> Modify the GET route to throw an exception:
>
> {code:java}
> from("direct:getPetById")
> .process(e -> {
> throw new RuntimeException("Simulated error get pet");
> });
> {code}
>
> Start the application with spring-boot:run, then trigger the endpoint:
> {code:java}
> curl http://0.0.0.0:8080/myapp/myapi/pet/123 {code}
> The log statement of the exception handler shows up twice (as well as the
> Failed delivery logging).
>
> The problem seem to have started with version 4.14.3 (4.14.2 does not show
> this behavior).
>
> I have tried to debug the problem, but have too narrow knowledge about the
> code base to be of any help (sorry!)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)