[
https://issues.apache.org/jira/browse/CAMEL-22874?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18053709#comment-18053709
]
Bjorn Beskow commented on CAMEL-22874:
--------------------------------------
I cannot reproduce the same behaviour using a simple timer, neither when
triggering the route using a "rest:", "cxf:" or "jms:" endpoint.
Also, I cannot reproduce it using the regular (non-comtract-first) openapi
component (I made the same modifications to the
camel-example-spring-boot-rest-openapi project, and it doesn't exhibit that
behaviour.
Hence the problem seems indeed to be specific to the openapi-contract-first
component.
> 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
> Fix For: 4.14.5, 4.18.0
>
> Attachments: openapi-contract-first.zip
>
>
> 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!)
>
> Attached is a simplified project based on
> camel-example-spring-boot-openapi-contract-first, with an integration test
> added that exposes the problem.
> Change the <camel-version> in pom.xml back to <= 4.14.2, and the problem
> disappears.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)