[ 
https://issues.apache.org/jira/browse/CAMEL-20731?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-20731.
---------------------------------
    Fix Version/s: 4.0.6
                   4.4.3
                   4.6.0
                       (was: 4.x)
         Assignee: Claus Ibsen
       Resolution: Fixed

Thanks for the sample project

> Route coverage fails on routes with multiple doCatch blocks
> -----------------------------------------------------------
>
>                 Key: CAMEL-20731
>                 URL: https://issues.apache.org/jira/browse/CAMEL-20731
>             Project: Camel
>          Issue Type: Bug
>          Components: tooling
>    Affects Versions: 4.0.3
>            Reporter: Adriano Machado
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.0.6, 4.4.3, 4.6.0
>
>         Attachments: multiple-catch-blocks-reproducer.patch
>
>
> Routes containing `doTry` with multiple `doCatch` blocks fails when running 
> the code coverage mojo.  An example:
> {code:java}
> <routes xmlns="http://camel.apache.org/schema/spring";>
>     <route id="multiple-catch-blocks">
>         <from uri="direct:start"/>
>         <doTry>
>             <to uri="mock:result"/>
>             <doCatch>
>                 <exception>java.io.IOException</exception>
>                 <to uri="mock:catch"/>
>             </doCatch>
>             <doCatch>
>                 <exception>java.lang.IllegalStateException</exception>
>                 <to uri="mock:catch"/>
>             </doCatch>
>             <doFinally>
>                 <to uri="mock:finally"/>
>             </doFinally>
>         </doTry>
>     </route>
> </routes>{code}
> Applying the attached patch gives the following error message:
> {noformat}
> [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.619 
> s -- in sample.camel.MultipleCatchBlocksTest
> [INFO] Running sample.camel.SampleCamelApplicationTest
> [WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 
> 0.008 s -- in sample.camel.SampleCamelApplicationTest
> [INFO]
> [INFO] Results:
> [INFO]
> [WARNING] Tests run: 2, Failures: 0, Errors: 0, Skipped: 1
> [INFO]
> [INFO]
> [INFO] --- camel-report:4.6.0-SNAPSHOT:route-coverage (default-cli) @ 
> camel-example-spring-boot-xml ---
> [INFO] Discovered 2 routes
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  17.235 s
> [INFO] Finished at: 2024-05-02T13:13:57-04:00
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal 
> org.apache.camel:camel-report-maven-plugin:4.6.0-SNAPSHOT:route-coverage 
> (default-cli) on project camel-example-spring-boot-xml: Error during 
> gathering route coverage data for route: multiple-catch-blocks: count is 
> negative: -1 -> [Help 1]
> [ERROR]
> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
> switch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR]
> [ERROR] For more information about the errors and possible solutions, please 
> read the following articles:
> [ERROR] [Help 1] 
> http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException{noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to