Nikolai Penkov created CXF-6092:
-----------------------------------

             Summary: When there is bad connection/timeout, ClientImpl throws 
NullPointerException
                 Key: CXF-6092
                 URL: https://issues.apache.org/jira/browse/CXF-6092
             Project: CXF
          Issue Type: Bug
          Components: Core
    Affects Versions: 3.0.2, 2.7.13, 2.7.12, 2.7.11
            Reporter: Nikolai Penkov


When the connection when executing WebService all is interrupted or timed out, 
there is some kind of racing issue and the result is
(the stacktrace and src code is from v. 2.7.11, but the same code is also in 
the other versions)

Caused by: java.lang.NullPointerException
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:396)

I suppose the problem is that when the connection is timed out/closed, the 
destroy() method is called in ClientImpl, where there is a statement that sets 
responseContext = null;

and then in the finalize block of the invoke, there is the code that produces 
the NPE:

} finally {
            if (context != null) {
                Map<String, Object> resp = CastUtils.cast((Map<?, 
?>)context.get(RESPONSE_CONTEXT));
                if (resp != null) {
--NPE----->                    responseContext.put(Thread.currentThread(), 
resp);
                }
            }
        }

One possible solutions is to add verification also for not null value in 
responseContext.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to