You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Willem Jiang (JIRA)" <ji...@apache.org> on 2011/06/15 04:18:47 UTC

[jira] [Commented] (CXF-3590) Exception when setPrettyLogging(true) for LoggingInInterceptor (or LoggingOutInterceptor)

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

Willem Jiang commented on CXF-3590:
-----------------------------------

It's not safe to change the setPrettyLogging(true) when you write the message, as the interceptor will be called by multiple thread. We need to fix it in the super.writePayload(builder, cos, encoding, contentType).

> Exception when setPrettyLogging(true) for LoggingInInterceptor (or LoggingOutInterceptor)
> -----------------------------------------------------------------------------------------
>
>                 Key: CXF-3590
>                 URL: https://issues.apache.org/jira/browse/CXF-3590
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.4.1
>            Reporter: Sergei Danilov
>            Assignee: Willem Jiang
>            Priority: Minor
>
> to reproduce
> create own logging interceptor
> public class PrettyLoggingInInterceptor extends LoggingInInterceptor {
>   @Override
>   protected void writePayload(StringBuilder builder, CachedOutputStream cos,
>       String encoding, String contentType)
>       throws Exception {
>     setPrettyLogging(true);
>     super.writePayload(builder, cos, encoding, contentType);
>   }
> }
> 1. add PrettyLoggingInInterceptor to web service 
> 2. run client 
> 3. javax.wsdl.WSDLException: WSDLException arise because some client request have no content (e.g get wsdl)
> workaround
> public class PatchPrettyLoggingInInterceptor extends LoggingInInterceptor {
>   @Override
>   protected void writePayload(StringBuilder builder, CachedOutputStream cos,
>       String encoding, String contentType)
>       throws Exception {
>     setPrettyLogging(true);
>     //patch
>     if (cos.size() == 0)
>       setPrettyLogging(false);
>     super.writePayload(builder, cos, encoding, contentType);
>   }
> }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira