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

Error when http.proxy* system properties are empty

    XMLWordPrintableJSON

Details

    • Novice

    Description

      Hi,

      we have an Apache CXF client configured using Spring. In the production environment the following system properties exist and the are both empty:

      http.proxyHost=
      http.proxyPort=
      

      This causes the following exception:

      java.lang.NumberFormatException: For input string: ""
      	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:59)
      	at java.lang.Integer.parseInt(Integer.java:481)
      	at java.lang.Integer.valueOf(Integer.java:565)
      	at org.apache.cxf.transport.http.ProxyFactory.createSystemProxyConfiguration(ProxyFactory.java:75)
      	at org.apache.cxf.transport.http.ProxyFactory.<init>(ProxyFactory.java:59)
      	at org.apache.cxf.transport.http.HTTPConduit.<init>(HTTPConduit.java:288)
      	at org.apache.cxf.transport.http.URLConnectionHTTPConduit.<init>(URLConnectionHTTPConduit.java:66)
      	at org.apache.cxf.transport.http.HTTPTransportFactory.getConduit(HTTPTransportFactory.java:258)
      	at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:238)
      	at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:245)
      	at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:103)
      	at org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelector.java:63)
      	at org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:850)
      	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:525)
      	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
      	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
      	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
      	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
      	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:133)
      	... 57 more
      

      I think ProxyFactory.java around line 66 should handle empty string for proxyHost the same way as NULL.

      String proxyHost = SystemPropertyAction.getPropertyOrNull(HTTP_PROXY_HOST);
      if (proxyHost != null) {
                  // System is configured with a proxy, use it
      

      Furthermore, it seems that even using http:conduit in our Spring config, it's not possible to override the system properties for a jaxws:client. The following block works only if the http.proxyHost system properties are not defined:

       <http:conduit name="*.http-conduit">
          <http:client
          	ProxyServer="somehost"
           	ProxyServerPort="123"/>
      </http:conduit>
      

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            ambro23 Milan Farkas
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: