You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Freeman Fang (JIRA)" <ji...@apache.org> on 2012/12/19 09:17:14 UTC
[jira] [Resolved] (CXF-4710) System properties -Dhttp.nonProxyHosts
from maven proxy settings is not filled and has side-effects on jvm
[ https://issues.apache.org/jira/browse/CXF-4710?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Freeman Fang resolved CXF-4710.
-------------------------------
Resolution: Duplicate
> 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
> Assignee: Freeman Fang
> 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