camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Gueze (Updated) (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-4513) simple predicate fails to introspect the exception in an onException clause using onWhen
Date Tue, 04 Oct 2011 15:16:34 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-4513?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Thomas Gueze updated CAMEL-4513:
--------------------------------

    Description: 
The bug occured in the 2.6.0 version of Camel I'm using. I haven't test it against the latest
version but I've checked the sources and it doesn't seem to have change since.

Given a camel route, with a onException clause like this :

{code}
this.onException(MyException.class)
    .onWhen(simple("${exception.myExceptionInfo.aValue} == true"))
    ...
{code}

MyException is a customed exception like this :

{code:title=MyException.java}
public class MyException extends Exception {
   ....
   public MyExceptionInfo getMyExceptionInfo() {
     ...
   }
}
{code}

What I've observed is that when BeanExpression.OgnlInvokeProcessor.process iterate through
the methods to calls, it does :
{code}
                // only invoke if we have a method name to use to invoke
                if (methodName != null) {
                    InvokeProcessor invoke = new InvokeProcessor(holder, methodName);
                    invoke.process(resultExchange);

                    // check for exception and rethrow if we failed
                    if (resultExchange.getException() != null) {
                        throw new RuntimeBeanExpressionException(exchange, beanName, methodName,
resultExchange.getException());
                    }

                    result = invoke.getResult();
                }
{code}

It successfully invoke the method : invoke.process(resultExchange);
But it checks for exception in the exchange. Since we are in an exception clause, there is
an actual exception (thrown by the application, but unrelated with the expression language
search) and it fails

There is a simple workaround for that : writing his own predicate class to test wanted conditions

  was:
The bug occured in the 2.6.0 version of Camel I'm using. I haven't test it against the latest
version but I've checked the sources and it doesn't seem to have change since.

Given a camel route, with a onException clause like this :

this.onException(MyException.class)
    .onWhen(simple("${exception.myExceptionInfo.aValue} == true"))
    ...

MyException is a customed exception like this :

public class MyException extends Exception {
   ....
   public MyExceptionInfo getMyExceptionInfo() {
     ...
   }
}

What I've observed is that when BeanExpression.OgnlInvokeProcessor.process iterate through
the methods to calls, it does :

                // only invoke if we have a method name to use to invoke
                if (methodName != null) {
                    InvokeProcessor invoke = new InvokeProcessor(holder, methodName);
                    invoke.process(resultExchange);

                    // check for exception and rethrow if we failed
                    if (resultExchange.getException() != null) {
                        throw new RuntimeBeanExpressionException(exchange, beanName, methodName,
resultExchange.getException());
                    }

                    result = invoke.getResult();
                }

It successfully invoke the method : invoke.process(resultExchange);
But it checks for exception in the exchange. Since we are in an exception clause, there is
an actual exception (thrown by the application, but unrelated with the expression language
search) and it fails

There is a simple workaround for that : writing his own predicate class to test wanted conditions

    
> simple predicate fails to introspect the exception in an onException clause using onWhen
> ----------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4513
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4513
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Thomas Gueze
>            Priority: Minor
>
> The bug occured in the 2.6.0 version of Camel I'm using. I haven't test it against the
latest version but I've checked the sources and it doesn't seem to have change since.
> Given a camel route, with a onException clause like this :
> {code}
> this.onException(MyException.class)
>     .onWhen(simple("${exception.myExceptionInfo.aValue} == true"))
>     ...
> {code}
> MyException is a customed exception like this :
> {code:title=MyException.java}
> public class MyException extends Exception {
>    ....
>    public MyExceptionInfo getMyExceptionInfo() {
>      ...
>    }
> }
> {code}
> What I've observed is that when BeanExpression.OgnlInvokeProcessor.process iterate through
the methods to calls, it does :
> {code}
>                 // only invoke if we have a method name to use to invoke
>                 if (methodName != null) {
>                     InvokeProcessor invoke = new InvokeProcessor(holder, methodName);
>                     invoke.process(resultExchange);
>                     // check for exception and rethrow if we failed
>                     if (resultExchange.getException() != null) {
>                         throw new RuntimeBeanExpressionException(exchange, beanName,
methodName, resultExchange.getException());
>                     }
>                     result = invoke.getResult();
>                 }
> {code}
> It successfully invoke the method : invoke.process(resultExchange);
> But it checks for exception in the exchange. Since we are in an exception clause, there
is an actual exception (thrown by the application, but unrelated with the expression language
search) and it fails
> There is a simple workaround for that : writing his own predicate class to test wanted
conditions

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

        

Mime
View raw message