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

Claus Ibsen updated CAMEL-3025:
-------------------------------

    Description: 
ProxyHelper allows one to create a local proxy which invokes a method call on a 
remote bean by marshalling the request into a message object, sending the 
message, waiting for the result, unmarshalling the result, and returning the 
result to the caller.  On the remote end, a bean invocation must be set up to 
handle the invocation.  Consider the following service bean and proxy usage:

{code}
public interface MyService {

  public Result method() throws MyApplicationException;

}

MyService myService = ProxyHelper.createProxy(endpoint, MyService.class);

try {
  Result = myService.method();
}
catch(MyApplicationException mae) {
  ...
}
{code}

MyApplicationException is an application-level exception which should be 
handled by the caller.  The user of the proxy expects that if the remote 
invocation of MyService.method() fails with a MyApplicationException, that the 
same exception should be thrown by the proxy instance.  Instead, the proxy 
instance is currently throwing a CamelRuntimeException which wraps the original 
MyApplicationException.  I propose that the proxy invocation handler used by 
ProxyHelper should check if the wrapped "cause" is of one of the declared 
exception types of the method being proxied, and if so, to unwrap and throw 
that exception instead of the CamelRuntimeException.

  was:
ProxyHelper allows one to create a local proxy which invokes a method call on a 
remote bean by marshalling the request into a message object, sending the 
message, waiting for the result, unmarshalling the result, and returning the 
result to the caller.  On the remote end, a bean invocation must be set up to 
handle the invocation.  Consider the following service bean and proxy usage:

public interface MyService {

  public Result method() throws MyApplicationException;

}

MyService myService = ProxyHelper.createProxy(endpoint, MyService.class);

try {
  Result = myService.method();
}
catch(MyApplicationException mae) {
  ...
}

MyApplicationException is an application-level exception which should be 
handled by the caller.  The user of the proxy expects that if the remote 
invocation of MyService.method() fails with a MyApplicationException, that the 
same exception should be thrown by the proxy instance.  Instead, the proxy 
instance is currently throwing a CamelRuntimeException which wraps the original 
MyApplicationException.  I propose that the proxy invocation handler used by 
ProxyHelper should check if the wrapped "cause" is of one of the declared 
exception types of the method being proxied, and if so, to unwrap and throw 
that exception instead of the CamelRuntimeException.


> ProxyHelper bean proxy should unwrap "cause" from RuntimeCamelException if 
> the cause's type is declared thrown by the proxied method
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3025
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3025
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: bean-integration
>            Reporter: Jim Newsham
>             Fix For: 2.5.0
>
>
> ProxyHelper allows one to create a local proxy which invokes a method call on 
> a remote bean by marshalling the request into a message object, sending the 
> message, waiting for the result, unmarshalling the result, and returning the 
> result to the caller.  On the remote end, a bean invocation must be set up to 
> handle the invocation.  Consider the following service bean and proxy usage:
> {code}
> public interface MyService {
>   public Result method() throws MyApplicationException;
> }
> MyService myService = ProxyHelper.createProxy(endpoint, MyService.class);
> try {
>   Result = myService.method();
> }
> catch(MyApplicationException mae) {
>   ...
> }
> {code}
> MyApplicationException is an application-level exception which should be 
> handled by the caller.  The user of the proxy expects that if the remote 
> invocation of MyService.method() fails with a MyApplicationException, that 
> the same exception should be thrown by the proxy instance.  Instead, the 
> proxy instance is currently throwing a CamelRuntimeException which wraps the 
> original MyApplicationException.  I propose that the proxy invocation handler 
> used by ProxyHelper should check if the wrapped "cause" is of one of the 
> declared exception types of the method being proxied, and if so, to unwrap 
> and throw that exception instead of the CamelRuntimeException.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to