Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-20731

Route coverage fails on routes with multiple doCatch blocks

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.0.3
    • 4.0.6, 4.4.3, 4.6.0
    • tooling
    • None
    • Unknown

    Description

      Routes containing `doTry` with multiple `doCatch` blocks fails when running the code coverage mojo.  An example:

      <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>

      Applying the attached patch gives the following error message:

      [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

       

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            ammachado Adriano Machado
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: