Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6092

When there is bad connection/timeout, ClientImpl throws NullPointerException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7.11, 2.7.12, 2.7.13, 3.0.2
    • 3.0.3, 2.7.14
    • Core
    • None
    • Unknown

    Description

      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.

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            npenkov Nikolai Penkov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: