Skip to content

CAMEL-21014: Fixed doFinally clause with route template#14913

Merged
orpiske merged 2 commits intoapache:mainfrom
imolainformatica:main
Jul 25, 2024
Merged

CAMEL-21014: Fixed doFinally clause with route template#14913
orpiske merged 2 commits intoapache:mainfrom
imolainformatica:main

Conversation

@carnevalegiacomo
Copy link
Contributor

@carnevalegiacomo carnevalegiacomo commented Jul 23, 2024

Description

In the TryDefinition class, the following condition is always true when copyDefinition is used:
if (finallyClause != null && output != finallyClause) {
throw new IllegalArgumentException(
"Multiple finally clauses added: " + finallyClause + " and " + output);
}

Added src/test/java/org/apache/camel/model/TryDefinitionTest.java:

  • tryDefinition with only one doFinally

  • copyDefinition

  • no exception is expected

  • tryDefinition with two doFinally

  • copyDefinition

  • exception is expected

c446202
TryDefinitionTest: reproduced IllegalArgumentException with only one doFinally clause

[ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0

Fix: removed if (finallyClause != null && output != finallyClause) and added doFinally clause counter
a1144f1

Fix IllegalArgumentException on a single doFinally clause due to object copying and the comparison finallyClause != output (always true due to the copying)

[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

Target

  • I checked that the commit is targeting the correct branch (note that Camel 3 uses camel-3.x, whereas Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.
  • I have run mvn clean install -DskipTests locally and I have committed all auto-generated changes

…doFinally clause

[ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0
…ct copying and the comparison finallyClause != output (always true due to the copying)

[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
@github-actions
Copy link
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟

🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run

  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot.

  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.

  • Build and test logs are available in the Summary page. Only Apache Camel committers have access to the summary.

  • ⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@carnevalegiacomo carnevalegiacomo changed the title Fix doFinally clause with route template Fixed doFinally clause with route template Jul 23, 2024
Copy link
Contributor

@orpiske orpiske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. Marking this as a request changes we need:

  1. Run a manual full test
  2. A ticket
  3. More reviews

@carnevalegiacomo carnevalegiacomo requested a review from orpiske July 24, 2024 06:57
@orpiske
Copy link
Contributor

orpiske commented Jul 24, 2024

Thanks for your contribution. Marking this as a request changes we need:

1. Run a manual full test

2. A ticket

3. More reviews

First full test run fine. Nice one @carnevalegiacomo!

Let's wait for more reviews (and, also, creating a ticket would be recommended - even though this is small, it is modifying the core code).

@carnevalegiacomo
Copy link
Contributor Author

Thanks for your contribution. Marking this as a request changes we need:

1. Run a manual full test

2. A ticket

3. More reviews

First full test run fine. Nice one @carnevalegiacomo!

Let's wait for more reviews (and, also, creating a ticket would be recommended - even though this is small, it is modifying the core code).

Hi

https://issues.apache.org/jira/projects/CAMEL/issues/CAMEL-21014?filter=allopenissues

@orpiske orpiske changed the title Fixed doFinally clause with route template CAMEL-21014: Fixed doFinally clause with route template Jul 24, 2024
@orpiske orpiske merged commit 241ce9a into apache:main Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants