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

Freeman Fang commented on CXF-4710:
-----------------------------------

Hi,

I believe CXF-4687 already fixed this issue.
Now we restore proxy settings after cxf-codegen-plugin running, so the proxy 
configuration only take effect in cxf-codegen-plugin life and won't affect 
other plugins.

Freeman

                
> System properties -Dhttp.nonProxyHosts from maven proxy settings is not 
> filled and has side-effects on jvm
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-4710
>                 URL: https://issues.apache.org/jira/browse/CXF-4710
>             Project: CXF
>          Issue Type: Improvement
>          Components: Build system
>    Affects Versions: 2.5.4, 2.5.5, 2.5.6, 2.5.7
>            Reporter: Arnaud Nauwynck
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> The System.properties -Dhttp.nonProxyHosts=.... is not set during the Mojo 
> executions, but others parameters for http proxy are set ( useProxy, 
> http.proxyHost, http.proxyPort), resulting in inconsistencies .
> This is particulary annoying when using plugin cxf-maven-plugin and then 
> another plugin in the same jvm, like jetty:run or failsafe/surefire ... 
> The bugs occurs for example in mvn jetty:run after, doing a 
> HttpURLConnection, with exception like "407 Proxy authentication required" 
> while trying to access a http resource within the intranet, that should have 
> by-passed the proxy but which is not due to missing -Dhttp.nonProxyHosts. 
> Notice that to reproduce the problem, you must have a very restrictive proxy 
> with authentication (like ntlm), and the bug occurs because credentials 
> user/password are also not set passed from maven to the jvm.
> The bug is in 
> cxf-codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
> line 332
> The following line is missing : 
>    System.setProperty("http.nonProxyHosts", 
> String.valueOf(proxy.getNonProxyHosts()));
> Remarks:
> 1) to avoid side-effects on the current jvm, you could also restore previous 
> value in a try-finally :
>    String PROP = "http.nonProxyHosts"; // cf also http.proxyHost ..
>    String requiredPropValue = "localhost|*.mydomain";
>    String oldPropertyValue = System.getProperty(PROP);
>    if (!requiredPropValue.equals(oldPropertyValue)) {
>       // temporary change property
>       System.setProperty(PROP, requiredPropValue);
>    }
>    try {
>       // *** do work in cxf-plugin ***
>    } finally {
>       // restore old property value
>       if (!requiredPropValue.equals(oldPropertyValue)) {
>          System.setProperty(PROP, oldPropertyValue);
>       }
>    }  
>    
> 2) You should also use the credentials login/password in case of 
> authenticating proxy... 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to