Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 469E8D355 for ; Wed, 19 Dec 2012 08:17:14 +0000 (UTC) Received: (qmail 56053 invoked by uid 500); 19 Dec 2012 08:17:14 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 55928 invoked by uid 500); 19 Dec 2012 08:17:13 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 55776 invoked by uid 99); 19 Dec 2012 08:17:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Dec 2012 08:17:13 +0000 Date: Wed, 19 Dec 2012 08:17:13 +0000 (UTC) From: "Freeman Fang (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Assigned] (CXF-4710) System properties -Dhttp.nonProxyHosts from maven proxy settings is not filled and has side-effects on jvm MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-4710?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Freeman Fang reassigned CXF-4710: --------------------------------- Assignee: Freeman Fang > 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