Giacomo Carnevale created CAMEL-21014:
-----------------------------------------

             Summary: The doFinally clause with a route template always 
generates an exception.
                 Key: CAMEL-21014
                 URL: https://issues.apache.org/jira/browse/CAMEL-21014
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 4.7.0
            Reporter: Giacomo Carnevale
             Fix For: 4.8.0


The doFinally clause with a route template always generates an exception.

 

Route template uses TryDefinition.copyDefinition method  that uses this 
constructor:
{code:java}
protected TryDefinition(TryDefinition source) {
    super(source);
    this.catchClauses = 
ProcessorDefinitionHelper.deepCopyDefinitions(source.catchClauses);
    this.finallyClause = source.finallyClause != null ? 
source.finallyClause.copyDefinition() : null;
} {code}
 

The checkInitialized always fails on this control:

 
{code:java}
if (finallyClause != null && output != finallyClause) {
                        throw new IllegalArgumentException(
                                "Multiple finally clauses added: " + 
finallyClause + " and " + output);
                    } {code}

Using copyDefinition method output and finallyClause are always differnt.

 

I created this pull request: [https://github.com/apache/camel/pull/14913]
{{}}

[{{c446202}}|https://github.com/apache/camel/commit/c44620258ef9c82b1e84bb34cff8f68734517cde]

commit to reproduce the bug with TryDefinitionTest

 

[{{a1144f1}}|https://github.com/apache/camel/commit/a1144f1e8736546a8f87d3c0bca9c8f2d9a070d6]

commit to fix the bug with a finally clause counter

 

 

 



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

Reply via email to