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

NullPointerException in AsyncHTTPConduit if http.noProxyHosts set

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.7.6, 2.7.7, 2.7.8, 2.7.9, 2.7.10, 2.7.11
    • Fix Version/s: 2.7.12, 3.0.1
    • Component/s: Transports
    • Labels:
    • Environment:

      Windows or Linux

    • Estimated Complexity:
      Novice

      Description

      This issue occurs when using the asynchronous conduit (use.async.http.conduit set to true), AND with the environment proxy configuration set (http.proxyHost, http.proxyPort, and http.nonProxyHosts properties set).
      The end of the AsyncHTTPConduit.setupConnection() method calls:
      <code>
      Proxy p = proxyFactory.createProxy(csPolicy , uri);
      if (p != null) {
      </code>
      When the http.nonProxyHosts property matches the target server host, then the ProxyFactory.createProxy() method returns Proxy.NO_PROXY, and not null. This means that because p is not null, the next 2 lines are executed:
      <code>
      InetSocketAddress isa = (InetSocketAddress)p.address();
      HttpHost proxy = new HttpHost(isa.getHostName(), isa.getPort());
      </code>
      p.address() returns null as expected, which means that the next line (line 200 in release 2.7.6) causes a NullPointerException, and crashes the call.

      The fix would be simple, by replacing:
      <code>
      if (p != null) {
      </code>
      with
      <code>
      if (p != null && !p.type() == Proxy.Type.DIRECT) {
      </code>

        Attachments

          Activity

            People

            • Assignee:
              dkulp Daniel Kulp
              Reporter:
              NotSoOldNick Nicolas Sprauel
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: