cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson Mao (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-4698) WebFaultOutInterceptor should use RumtimeException's cause
Date Mon, 17 Dec 2012 07:12:13 GMT

    [ https://issues.apache.org/jira/browse/CXF-4698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13533697#comment-13533697
] 

Anderson Mao commented on CXF-4698:
-----------------------------------

The below code will be better to use cause itself to get WebFault first. And use cause.getCause()
as secondary option.
----
        WebFault fault = null;
        if (cause != null) {
            fault = getWebFaultAnnotation(cause.getClass());
            if(fault == null && cause.getCause() !=null){
            	cause = cause.getCause();
            	fault = getWebFaultAnnotation(cause.getClass());
            }
        }
                
> WebFaultOutInterceptor should use RumtimeException's cause
> ----------------------------------------------------------
>
>                 Key: CXF-4698
>                 URL: https://issues.apache.org/jira/browse/CXF-4698
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.7.1
>         Environment: apache-cxf-2.7.0
> Use JaxWsServerFactoryBean
> factory.getOutFaultInterceptors().add(new WebFaultOutInterceptor() );
>            Reporter: Anderson Mao
>
> WebFaultOutInterceptor.java should use RumtimeException's cause
> http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
> ---- Revision 1421074, line 86
> Throwable cause = f.getCause();
> WebFault fault = null;
> if (cause != null) {
>     fault = getWebFaultAnnotation(cause.getClass());
> }
> ----
> When the "cause" is instance of RuntimeException. Will get null WebFault.
> Should be fixed by use cause's cause.
> ---- Fix code
> WebFault fault = null;
> if(cause!=null && cause instanceof RuntimeException && cause.getCause()!=null){
>     cause = cause.getCause();
> }
> if (cause != null) {
>     fault = getWebFaultAnnotation(cause.getClass());
> }
> ----
> Thanks a lot
> Anderson Mao
> 2012-12-13

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

Mime
View raw message