[ 
https://issues.apache.org/jira/browse/CAMEL-22874?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18056189#comment-18056189
 ] 

Bjorn Beskow commented on CAMEL-22874:
--------------------------------------

71bf0dc8cfc868d722e9f34bb521ffae13d225f3 is the first bad commit
commit 71bf0dc8cfc868d722e9f34bb521ffae13d225f3
Author: Claus Ibsen <[email protected]>
Date:   Mon Dec 1 10:58:30 2025 +0100

    CAMEL-22742: camel-core - Rest DSL contract first should have jmx 
statistics (#20101)

    * CAMEL-22742: camel-core - Rest DSL contract first should have jmx 
statistics

 components/camel-platform-http-vertx/pom.xml       |   5 ++
 ...RestOpenApiConsumerRestDslRouteMetricsTest.java | 100 +++++++++++++++++++++
 ...PlatformHttpRestOpenApiConsumerRestDslTest.java |   5 +-
 .../vertx/PlatformHttpRestOpenApiConsumerTest.java |  15 +++-
 .../platform/http/DefaultPlatformHttpConsumer.java |  16 +++-
 .../http/spi/PlatformHttpConsumerAware.java        |   9 ++
 .../rest/openapi/RestOpenApiComponent.java         |   7 +-
 .../rest/openapi/RestOpenApiEndpoint.java          |  73 +++++++++++++--
 .../rest/openapi/RestOpenApiProcessor.java         |  63 ++++++-------
 .../org/apache/camel/spi/InternalProcessor.java    |   7 ++
 .../camel/impl/engine/CamelInternalProcessor.java  |   7 ++
 .../apache/camel/model/rest/RestDefinition.java    |   3 +-
 12 files changed, 263 insertions(+), 47 deletions(-)
 create mode 100644 
components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/PlatformHttpRestOpenApiConsumerRestDslRouteMetricsTest.java

> Error handler in openapi-contract-first 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 
> openapi-contract-first 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)

Reply via email to