You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Parwiz Rezai (JIRA)" <ji...@apache.org> on 2013/03/22 07:29:15 UTC
[jira] [Updated] (CXF-4912) cxf rest client always picks the first
ResponseExceptionMapper for a method with different exception throws
[ https://issues.apache.org/jira/browse/CXF-4912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Parwiz Rezai updated CXF-4912:
------------------------------
Description:
I have two differnt exceptions:
public class Exception1 extends Exception {
// blah blah
}
public class Exception2 extends Exception {
// blah blah
}
public class Exception1ResponseMapper implements ResponseExceptionMapper<Exception1> {
}
public class Exception2ResponseMapper implements ResponseExceptionMapper<Exception2> {
}
so one mapper does something different than the other one.
now my service method:
public interface MyService {
SomeCoolObject myMethod() throws Exception2, Exception1;
}
public class MyServiceImpl implements MyService {
public SomeCoolObject myMethod() throws Exception2, Exception1 {
throw new Exception1("hey this exception will still go exception 2 mapper.. why?");
}
}
The selection for response mapper will always pick the first
exception listed and invoke the mapper for that guy.. it will never
invoke Exception1ResponseMapper even though our exception is of type
Exception1..
I think the code needs to lookup the mapper based on type as well
instead of generic first mapper found for that service.
was:
I have two differnt exceptions
class Exception1 extends Exception {
// blah blah
}
class Exception2 extends Exception {
// blah blah
}
public class Exception1ResponseMapper implements ResponseExceptionMapper<Exception1> {}
public class Exception2ResponseMapper implements ResponseExceptionMapper<Exception2> {}
so one mapper does something different than the other one.
now my service method is
public interface MyService {
SomeCoolObject myMethod() throws Exception2, Exception1;
}
public class MyServiceImpl implements MyService {
public SomeCoolObject myMethod() throws Exception2, Exception1 {
throw new Exception1("hey this exception will still go exception 2 mapper.. why?");
}
}
The selection for response mapper will always pick the first
exception listed and invoke the mapper for that guy.. it will never
invoke Exception1ResponseMapper even though our exception is of type
Exception1..
I think the code needs to lookup the mapper based on type as well
instead of generic first mapper found for that service.
> cxf rest client always picks the first ResponseExceptionMapper for a method with different exception throws
> -----------------------------------------------------------------------------------------------------------
>
> Key: CXF-4912
> URL: https://issues.apache.org/jira/browse/CXF-4912
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 2.7.3
> Environment: tomcat 6.33, java 1.6_34, spring 3.2.1.RELEASE.
> Reporter: Parwiz Rezai
>
> I have two differnt exceptions:
> public class Exception1 extends Exception {
> // blah blah
> }
> public class Exception2 extends Exception {
> // blah blah
> }
> public class Exception1ResponseMapper implements ResponseExceptionMapper<Exception1> {
> }
> public class Exception2ResponseMapper implements ResponseExceptionMapper<Exception2> {
> }
> so one mapper does something different than the other one.
> now my service method:
> public interface MyService {
> SomeCoolObject myMethod() throws Exception2, Exception1;
> }
> public class MyServiceImpl implements MyService {
> public SomeCoolObject myMethod() throws Exception2, Exception1 {
> throw new Exception1("hey this exception will still go exception 2 mapper.. why?");
> }
> }
> The selection for response mapper will always pick the first
> exception listed and invoke the mapper for that guy.. it will never
> invoke Exception1ResponseMapper even though our exception is of type
> Exception1..
> I think the code needs to lookup the mapper based on type as well
> instead of generic first mapper found for that service.
--
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