You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Vadim Beilin (JIRA)" <ji...@apache.org> on 2014/01/20 23:32:19 UTC
[jira] [Commented] (CXF-5504)
AbstractLoggingInterceptor.getMessageLogger throws NPE when
MultipleEndpointObserver is used
[ https://issues.apache.org/jira/browse/CXF-5504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13876929#comment-13876929 ]
Vadim Beilin commented on CXF-5504:
-----------------------------------
Like this:
{code}
Logger getMessageLogger(Message message) {
// {{{
if (message.getExchange().getEndpoint() == null)
return getLogger();
// }}}
EndpointInfo endpoint = message.getExchange().getEndpoint().getEndpointInfo();
if (endpoint.getService() == null) {
return getLogger();
}
Logger logger = endpoint.getProperty("MessageLogger", Logger.class);
...
{code}
> AbstractLoggingInterceptor.getMessageLogger throws NPE when MultipleEndpointObserver is used
> --------------------------------------------------------------------------------------------
>
> Key: CXF-5504
> URL: https://issues.apache.org/jira/browse/CXF-5504
> Project: CXF
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.5
> Reporter: Vadim Beilin
>
> The method {{AbstractLoggingInterceptor#getMessageLogger(Message)}} that was introduced by CXF-3888 assumes that {{message.getExchange().getEndpoint()}} is not null.
> This assumption does not work if one uses {{org.apache.cxf.transport.MultipleEndpointObserver}} as the message observer, leading to NPE:
> {noformat}
> java.lang.NullPointerException: null
> at org.apache.cxf.interceptor.AbstractLoggingInterceptor.getMessageLogger(AbstractLoggingInterceptor.java:78) ~[cxf-2.5.9.jar:2.5.9]
> at org.apache.cxf.interceptor.LoggingInInterceptor.handleMessage(LoggingInInterceptor.java:73) ~[cxf-2.5.9.jar:2.5.9]
> at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) ~[cxf-2.5.9.jar:2.5.9]
> at org.apache.cxf.transport.MultipleEndpointObserver.onMessage(MultipleEndpointObserver.java:98) [cxf-2.5.9.jar:2.5.9]
> ...
> {noformat}
> Would it be possible to check first if endpoint is present?
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)