You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Christian Tytgat (JIRA)" <ji...@apache.org> on 2013/06/11 09:23:20 UTC

[jira] [Created] (CAMEL-6447) endChoice() has no effect in nested choice definition

Christian Tytgat created CAMEL-6447:
---------------------------------------

             Summary: endChoice() has no effect in nested choice definition
                 Key: CAMEL-6447
                 URL: https://issues.apache.org/jira/browse/CAMEL-6447
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.11.0
            Reporter: Christian Tytgat


I just upgraded from 2.10.4 to 2.11.0 and noticed that nested choice definitions started acting strangely. For example:

            .choice()
                .when(header(Exchange.EXCEPTION_CAUGHT).isNotNull())
                    // 1
                    .setBody(exceptionMessage().append(SystemUtils.LINE_SEPARATOR).append(exceptionStackTrace()))
                    .choice()
                        .when(header(HEADER_CONTROLLER_ID).isNotNull())
                            // 1a
                            .setHeader(Exchange.FILE_NAME, simple(AUDIT_CONTROLLER_FAILED_FILENAME + ".error.log"))
                            .to(ENDPOINT_AUDIT_DIR)
                        .otherwise()
                            // 1b
                            .setHeader(Exchange.FILE_NAME, simple(AUDIT_FAILED_FILENAME + ".error.log"))
                            .to(ENDPOINT_AUDIT_DIR)
                            // INSERTING .end() here solves the issue
                        .endChoice()
                    .log(LoggingLevel.WARN, "DLQ written: ${in.header.CamelExceptionCaught}" + MESSAGE_LOG_FORMAT)
                .otherwise()
                    // 2
                    .log(LoggingLevel.WARN, "DLQ written" + MESSAGE_LOG_FORMAT)
                .end()
            .end()

I have a test that is supposed to go through 1 and 1a. However it now passes through 1 and 2!
It looks like the endChoice() in 1b has no effect and the otherwise() in 2 is executed instead of 1b. Inserting and end() statement as shown seems to solve the issue, but it looks suspicious.

It's probably a regression introduced by the fix for CAMEL-5953, but I'm not 100% sure. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira