You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Andreas Jacobsen (JIRA)" <ji...@apache.org> on 2012/07/20 09:43:35 UTC

[jira] [Created] (CAMEL-5456) Context scoped exception clauses incorrectly applying across RouteBuilders

Andreas Jacobsen created CAMEL-5456:
---------------------------------------

             Summary: Context scoped exception clauses incorrectly applying across RouteBuilders
                 Key: CAMEL-5456
                 URL: https://issues.apache.org/jira/browse/CAMEL-5456
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.10.0
            Reporter: Andreas Jacobsen
         Attachments: camel-core-context-scope-bug.patch, camel-spring-context-scope-bug.patch

The attached patch shows a bug in the DefaultExceptionPolicyStrategy or the way ExceptionPolicys are added to a RouteBuilder's errorhandler.

In ContextScopedOnExceptionMultipleRouteBuildersReverseTest, the ordering of the routes causes the onException(IllegalArgumentException.class) to added to the ExceptionProcessors for the direct:foo-RouteBuilder. When the route is run, the OnExceptionDefinition matches exactly on the exception-type, despite this OnExceptionDefiniton being registered on a different RouteBuilder. As far as we can tell, the processor is later ignored because it's identified as being from a different route-context.

We have attached corresponding tests for camel-spring that show that the issue is tied to alphabetical ordering of RouteBuilders when using contextscan.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-5456) Context scoped exception clauses incorrectly applying across RouteBuilders

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13466223#comment-13466223 ] 

Claus Ibsen commented on CAMEL-5456:
------------------------------------

Yes this issue is related to Java DSL. It has a slightly different initialization logic than XML DSL etc.


                
> Context scoped exception clauses incorrectly applying across RouteBuilders
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-5456
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5456
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.10.0
>            Reporter: Andreas Jacobsen
>            Assignee: Claus Ibsen
>         Attachments: camel-core-context-scope-bug.patch, camel-spring-context-scope-bug.patch
>
>
> The attached patch shows a bug in the DefaultExceptionPolicyStrategy or the way ExceptionPolicys are added to a RouteBuilder's errorhandler.
> In ContextScopedOnExceptionMultipleRouteBuildersReverseTest, the ordering of the routes causes the onException(IllegalArgumentException.class) to added to the ExceptionProcessors for the direct:foo-RouteBuilder. When the route is run, the OnExceptionDefinition matches exactly on the exception-type, despite this OnExceptionDefiniton being registered on a different RouteBuilder. As far as we can tell, the processor is later ignored because it's identified as being from a different route-context.
> We have attached corresponding tests for camel-spring that show that the issue is tied to alphabetical ordering of RouteBuilders when using contextscan.

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

[jira] [Commented] (CAMEL-5456) Context scoped exception clauses incorrectly applying across RouteBuilders

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13439274#comment-13439274 ] 

Willem Jiang commented on CAMEL-5456:
-------------------------------------

Hi Andreas,
If you are using Context scoped exception clause,the error handler will be affect across the CamelContext, as the JAVA DSL onException() is called one by one in the two different route builder, the route will be effected different if the onException is called in different sequences. I don't think there is way to fix it in JAVA DSL, unless we setup the context scoped exception in one RouteBuilders or using the route scoped exception clauses.

The error the test can be fixed by setting the onException to be route scoped like the one I just committed a fixed test into the trunk.
                
> Context scoped exception clauses incorrectly applying across RouteBuilders
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-5456
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5456
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.10.0
>            Reporter: Andreas Jacobsen
>            Assignee: Willem Jiang
>         Attachments: camel-core-context-scope-bug.patch, camel-spring-context-scope-bug.patch
>
>
> The attached patch shows a bug in the DefaultExceptionPolicyStrategy or the way ExceptionPolicys are added to a RouteBuilder's errorhandler.
> In ContextScopedOnExceptionMultipleRouteBuildersReverseTest, the ordering of the routes causes the onException(IllegalArgumentException.class) to added to the ExceptionProcessors for the direct:foo-RouteBuilder. When the route is run, the OnExceptionDefinition matches exactly on the exception-type, despite this OnExceptionDefiniton being registered on a different RouteBuilder. As far as we can tell, the processor is later ignored because it's identified as being from a different route-context.
> We have attached corresponding tests for camel-spring that show that the issue is tied to alphabetical ordering of RouteBuilders when using contextscan.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (CAMEL-5456) Context scoped exception clauses incorrectly applying across RouteBuilders

Posted by "Andreas Jacobsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Jacobsen updated CAMEL-5456:
------------------------------------

    Attachment: camel-spring-context-scope-bug.patch
                camel-core-context-scope-bug.patch
    
> Context scoped exception clauses incorrectly applying across RouteBuilders
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-5456
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5456
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.10.0
>            Reporter: Andreas Jacobsen
>         Attachments: camel-core-context-scope-bug.patch, camel-spring-context-scope-bug.patch
>
>
> The attached patch shows a bug in the DefaultExceptionPolicyStrategy or the way ExceptionPolicys are added to a RouteBuilder's errorhandler.
> In ContextScopedOnExceptionMultipleRouteBuildersReverseTest, the ordering of the routes causes the onException(IllegalArgumentException.class) to added to the ExceptionProcessors for the direct:foo-RouteBuilder. When the route is run, the OnExceptionDefinition matches exactly on the exception-type, despite this OnExceptionDefiniton being registered on a different RouteBuilder. As far as we can tell, the processor is later ignored because it's identified as being from a different route-context.
> We have attached corresponding tests for camel-spring that show that the issue is tied to alphabetical ordering of RouteBuilders when using contextscan.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-5456) Context scoped exception clauses incorrectly applying across RouteBuilders

Posted by "Andreas Jacobsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13439301#comment-13439301 ] 

Andreas Jacobsen commented on CAMEL-5456:
-----------------------------------------

It can't possibly be correct that route-context-scoped exception clauses are dependent on the order of the routes they are tied to. That's insane. 
                
> Context scoped exception clauses incorrectly applying across RouteBuilders
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-5456
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5456
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.10.0
>            Reporter: Andreas Jacobsen
>            Assignee: Willem Jiang
>         Attachments: camel-core-context-scope-bug.patch, camel-spring-context-scope-bug.patch
>
>
> The attached patch shows a bug in the DefaultExceptionPolicyStrategy or the way ExceptionPolicys are added to a RouteBuilder's errorhandler.
> In ContextScopedOnExceptionMultipleRouteBuildersReverseTest, the ordering of the routes causes the onException(IllegalArgumentException.class) to added to the ExceptionProcessors for the direct:foo-RouteBuilder. When the route is run, the OnExceptionDefinition matches exactly on the exception-type, despite this OnExceptionDefiniton being registered on a different RouteBuilder. As far as we can tell, the processor is later ignored because it's identified as being from a different route-context.
> We have attached corresponding tests for camel-spring that show that the issue is tied to alphabetical ordering of RouteBuilders when using contextscan.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (CAMEL-5456) Context scoped exception clauses incorrectly applying across RouteBuilders

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang reassigned CAMEL-5456:
-----------------------------------

    Assignee: Willem Jiang
    
> Context scoped exception clauses incorrectly applying across RouteBuilders
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-5456
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5456
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.10.0
>            Reporter: Andreas Jacobsen
>            Assignee: Willem Jiang
>         Attachments: camel-core-context-scope-bug.patch, camel-spring-context-scope-bug.patch
>
>
> The attached patch shows a bug in the DefaultExceptionPolicyStrategy or the way ExceptionPolicys are added to a RouteBuilder's errorhandler.
> In ContextScopedOnExceptionMultipleRouteBuildersReverseTest, the ordering of the routes causes the onException(IllegalArgumentException.class) to added to the ExceptionProcessors for the direct:foo-RouteBuilder. When the route is run, the OnExceptionDefinition matches exactly on the exception-type, despite this OnExceptionDefiniton being registered on a different RouteBuilder. As far as we can tell, the processor is later ignored because it's identified as being from a different route-context.
> We have attached corresponding tests for camel-spring that show that the issue is tied to alphabetical ordering of RouteBuilders when using contextscan.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CAMEL-5456) Context scoped exception clauses incorrectly applying across RouteBuilders

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-5456.
--------------------------------

    Resolution: Fixed
    
> Context scoped exception clauses incorrectly applying across RouteBuilders
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-5456
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5456
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.10.0
>            Reporter: Andreas Jacobsen
>            Assignee: Claus Ibsen
>             Fix For: 2.9.4, 2.11.0, 2.10.2
>
>         Attachments: camel-core-context-scope-bug.patch, camel-spring-context-scope-bug.patch
>
>
> The attached patch shows a bug in the DefaultExceptionPolicyStrategy or the way ExceptionPolicys are added to a RouteBuilder's errorhandler.
> In ContextScopedOnExceptionMultipleRouteBuildersReverseTest, the ordering of the routes causes the onException(IllegalArgumentException.class) to added to the ExceptionProcessors for the direct:foo-RouteBuilder. When the route is run, the OnExceptionDefinition matches exactly on the exception-type, despite this OnExceptionDefiniton being registered on a different RouteBuilder. As far as we can tell, the processor is later ignored because it's identified as being from a different route-context.
> We have attached corresponding tests for camel-spring that show that the issue is tied to alphabetical ordering of RouteBuilders when using contextscan.

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

[jira] [Commented] (CAMEL-5456) Context scoped exception clauses incorrectly applying across RouteBuilders

Posted by "Andreas Jacobsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13439389#comment-13439389 ] 

Andreas Jacobsen commented on CAMEL-5456:
-----------------------------------------

So we've correctly identified a bug in the Java DSL then?
                
> Context scoped exception clauses incorrectly applying across RouteBuilders
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-5456
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5456
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.10.0
>            Reporter: Andreas Jacobsen
>            Assignee: Willem Jiang
>         Attachments: camel-core-context-scope-bug.patch, camel-spring-context-scope-bug.patch
>
>
> The attached patch shows a bug in the DefaultExceptionPolicyStrategy or the way ExceptionPolicys are added to a RouteBuilder's errorhandler.
> In ContextScopedOnExceptionMultipleRouteBuildersReverseTest, the ordering of the routes causes the onException(IllegalArgumentException.class) to added to the ExceptionProcessors for the direct:foo-RouteBuilder. When the route is run, the OnExceptionDefinition matches exactly on the exception-type, despite this OnExceptionDefiniton being registered on a different RouteBuilder. As far as we can tell, the processor is later ignored because it's identified as being from a different route-context.
> We have attached corresponding tests for camel-spring that show that the issue is tied to alphabetical ordering of RouteBuilders when using contextscan.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (CAMEL-5456) Context scoped exception clauses incorrectly applying across RouteBuilders

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-5456:
----------------------------------

    Assignee: Claus Ibsen  (was: Willem Jiang)
    
> Context scoped exception clauses incorrectly applying across RouteBuilders
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-5456
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5456
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.10.0
>            Reporter: Andreas Jacobsen
>            Assignee: Claus Ibsen
>         Attachments: camel-core-context-scope-bug.patch, camel-spring-context-scope-bug.patch
>
>
> The attached patch shows a bug in the DefaultExceptionPolicyStrategy or the way ExceptionPolicys are added to a RouteBuilder's errorhandler.
> In ContextScopedOnExceptionMultipleRouteBuildersReverseTest, the ordering of the routes causes the onException(IllegalArgumentException.class) to added to the ExceptionProcessors for the direct:foo-RouteBuilder. When the route is run, the OnExceptionDefinition matches exactly on the exception-type, despite this OnExceptionDefiniton being registered on a different RouteBuilder. As far as we can tell, the processor is later ignored because it's identified as being from a different route-context.
> We have attached corresponding tests for camel-spring that show that the issue is tied to alphabetical ordering of RouteBuilders when using contextscan.

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

[jira] [Updated] (CAMEL-5456) Context scoped exception clauses incorrectly applying across RouteBuilders

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-5456:
-------------------------------

    Fix Version/s: 2.11.0
    
> Context scoped exception clauses incorrectly applying across RouteBuilders
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-5456
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5456
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.10.0
>            Reporter: Andreas Jacobsen
>            Assignee: Claus Ibsen
>             Fix For: 2.11.0
>
>         Attachments: camel-core-context-scope-bug.patch, camel-spring-context-scope-bug.patch
>
>
> The attached patch shows a bug in the DefaultExceptionPolicyStrategy or the way ExceptionPolicys are added to a RouteBuilder's errorhandler.
> In ContextScopedOnExceptionMultipleRouteBuildersReverseTest, the ordering of the routes causes the onException(IllegalArgumentException.class) to added to the ExceptionProcessors for the direct:foo-RouteBuilder. When the route is run, the OnExceptionDefinition matches exactly on the exception-type, despite this OnExceptionDefiniton being registered on a different RouteBuilder. As far as we can tell, the processor is later ignored because it's identified as being from a different route-context.
> We have attached corresponding tests for camel-spring that show that the issue is tied to alphabetical ordering of RouteBuilders when using contextscan.

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

[jira] [Updated] (CAMEL-5456) Context scoped exception clauses incorrectly applying across RouteBuilders

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-5456:
-------------------------------

    Fix Version/s: 2.10.2
                   2.9.4
    
> Context scoped exception clauses incorrectly applying across RouteBuilders
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-5456
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5456
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.10.0
>            Reporter: Andreas Jacobsen
>            Assignee: Claus Ibsen
>             Fix For: 2.9.4, 2.11.0, 2.10.2
>
>         Attachments: camel-core-context-scope-bug.patch, camel-spring-context-scope-bug.patch
>
>
> The attached patch shows a bug in the DefaultExceptionPolicyStrategy or the way ExceptionPolicys are added to a RouteBuilder's errorhandler.
> In ContextScopedOnExceptionMultipleRouteBuildersReverseTest, the ordering of the routes causes the onException(IllegalArgumentException.class) to added to the ExceptionProcessors for the direct:foo-RouteBuilder. When the route is run, the OnExceptionDefinition matches exactly on the exception-type, despite this OnExceptionDefiniton being registered on a different RouteBuilder. As far as we can tell, the processor is later ignored because it's identified as being from a different route-context.
> We have attached corresponding tests for camel-spring that show that the issue is tied to alphabetical ordering of RouteBuilders when using contextscan.

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

[jira] [Commented] (CAMEL-5456) Context scoped exception clauses incorrectly applying across RouteBuilders

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13439383#comment-13439383 ] 

Willem Jiang commented on CAMEL-5456:
-------------------------------------

That is caused by the onException() are called in different sequence in RouteBuilder.configure method.
If you are using the spring DSL, you will never have this kind of issue.
{code}
   <camel>
      <onException>...</onException>
      <onException>...</onException>
      <route> ... </route>
      <route> ... </route>
   </camel>
{code} 
                
> Context scoped exception clauses incorrectly applying across RouteBuilders
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-5456
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5456
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.10.0
>            Reporter: Andreas Jacobsen
>            Assignee: Willem Jiang
>         Attachments: camel-core-context-scope-bug.patch, camel-spring-context-scope-bug.patch
>
>
> The attached patch shows a bug in the DefaultExceptionPolicyStrategy or the way ExceptionPolicys are added to a RouteBuilder's errorhandler.
> In ContextScopedOnExceptionMultipleRouteBuildersReverseTest, the ordering of the routes causes the onException(IllegalArgumentException.class) to added to the ExceptionProcessors for the direct:foo-RouteBuilder. When the route is run, the OnExceptionDefinition matches exactly on the exception-type, despite this OnExceptionDefiniton being registered on a different RouteBuilder. As far as we can tell, the processor is later ignored because it's identified as being from a different route-context.
> We have attached corresponding tests for camel-spring that show that the issue is tied to alphabetical ordering of RouteBuilders when using contextscan.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (CAMEL-5456) Context scoped exception clauses incorrectly applying across RouteBuilders

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13439274#comment-13439274 ] 

Willem Jiang edited comment on CAMEL-5456 at 8/22/12 4:00 PM:
--------------------------------------------------------------

Hi Andreas,

If you are using Context scoped exception clause,the error handler will be affect across the CamelContext, as the JAVA DSL onException() is called one by one in the two different route builder, the route will be effected different if the onException is called in different sequences. I don't think there is way to fix it in JAVA DSL, unless we setup the context scoped exception in one RouteBuilders or using the route scoped exception clauses.

The error the test can be fixed by setting the onException to be route scoped like the one I just committed a fixed test[1] into the trunk.

[1] http://svn.apache.org/viewvc?rev=1375896&view=rev

                
      was (Author: njiang):
    Hi Andreas,
If you are using Context scoped exception clause,the error handler will be affect across the CamelContext, as the JAVA DSL onException() is called one by one in the two different route builder, the route will be effected different if the onException is called in different sequences. I don't think there is way to fix it in JAVA DSL, unless we setup the context scoped exception in one RouteBuilders or using the route scoped exception clauses.

The error the test can be fixed by setting the onException to be route scoped like the one I just committed a fixed test into the trunk.
                  
> Context scoped exception clauses incorrectly applying across RouteBuilders
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-5456
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5456
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.10.0
>            Reporter: Andreas Jacobsen
>            Assignee: Willem Jiang
>         Attachments: camel-core-context-scope-bug.patch, camel-spring-context-scope-bug.patch
>
>
> The attached patch shows a bug in the DefaultExceptionPolicyStrategy or the way ExceptionPolicys are added to a RouteBuilder's errorhandler.
> In ContextScopedOnExceptionMultipleRouteBuildersReverseTest, the ordering of the routes causes the onException(IllegalArgumentException.class) to added to the ExceptionProcessors for the direct:foo-RouteBuilder. When the route is run, the OnExceptionDefinition matches exactly on the exception-type, despite this OnExceptionDefiniton being registered on a different RouteBuilder. As far as we can tell, the processor is later ignored because it's identified as being from a different route-context.
> We have attached corresponding tests for camel-spring that show that the issue is tied to alphabetical ordering of RouteBuilders when using contextscan.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira