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

Freeman Fang edited comment on CXF-3585 at 6/14/11 7:28 AM:
------------------------------------------------------------

Hi David,

I'm wondering how you use EndpointSelectionInterceptor?
By my test, If there's an EndpointSelectionInterceptor in the InInterceptor 
Chain, it always get invoked before the WSDLGetInterceptor, so I'm curious how 
you see the NPE. We may not use same scenario, so if you can append a testcase, 
it would be great.

Anyway, I think add 
getAfter().add(EndpointSelectionInterceptor.class.getName());
for WSDLGetInterceptor constructor which ensure WSDLGetInterceptor always get 
invoked after EndpointSelectionInterceptor(as both are in same phase) if 
there's an EndpointSelectionInterceptor in the chain should be good.

Freeman


      was (Author: ffang):
    Hi David,

I'm wondering how you use EndpointSelectionInterceptor?
By my test, If there's an EndpointSelectionInterceptor in the InInterceptor 
Chain, it always get invoked before the WSDLGetInterceptor, so I'm curious how 
you see the NPE. We may not use same scenario, so if you can append a testcase, 
it would be great.

Anyway, I think add 
getAfter().add(EndpointSelectionInterceptor.class.getName());
for WSDLGetInterceptor constructor which ensure WSDLGetInterceptor always get 
invoked after EndpointSelectionInterceptor if there's an 
EndpointSelectionInterceptor in the chain should be good.

Freeman

  
> WSDLGetInterceptor throws NullPointException when using 
> EndpointSelectionInterceptor
> ------------------------------------------------------------------------------------
>
>                 Key: CXF-3585
>                 URL: https://issues.apache.org/jira/browse/CXF-3585
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.4
>            Reporter: David Liu
>            Assignee: Freeman Fang
>
> Hi, 
>   It looks like WSDLGetInterceptor assumes that the current exchange has one 
> Endpoint, however, there is the case we can use EndpointSelectionInterceptor 
> to get the Endpoint later, so the Endpoint could be null and which causes 
> NullPointException .
> e.g. WSDLGetInterceptor expects one Endpoint,
> {code}
> class WSDLGetInterceptor {
>         //cannot have two wsdl's being written for the same endpoint at the 
> same
>         //time as the addresses may get mixed up
>         synchronized (message.getExchange().getEndpoint()) {  <-- 
> NullPointException 
>  ...
> {code}
> However, the Endpoint is null at this moment and it will be set in 
> EndpointSelectionInterceptor later.
> {code}
>     public void handleMessage(Message message) throws Fault {
>         Exchange ex = message.getExchange();
>         Set<Endpoint> endpoints = 
> CastUtils.cast((Set)ex.get(MultipleEndpointObserver.ENDPOINTS));
>         Endpoint ep = selectEndpoint(message, endpoints);
>         if (ep == null) {
>             return;
>         }
>         ex.put(Endpoint.class, ep);
> {code}
> David

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

        

Reply via email to