Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E3CD0200CBA for ; Mon, 3 Jul 2017 19:36:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E1B52160BEC; Mon, 3 Jul 2017 17:36:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0CC39160BD2 for ; Mon, 3 Jul 2017 19:36:03 +0200 (CEST) Received: (qmail 77082 invoked by uid 500); 3 Jul 2017 17:36:03 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 77073 invoked by uid 99); 3 Jul 2017 17:36:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jul 2017 17:36:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id D46F4C023D for ; Mon, 3 Jul 2017 17:36:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id LoEIpTtWb0Ng for ; Mon, 3 Jul 2017 17:36:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id D0AB65F341 for ; Mon, 3 Jul 2017 17:36:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 57B56E002B for ; Mon, 3 Jul 2017 17:36:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 0EB3824602 for ; Mon, 3 Jul 2017 17:36:00 +0000 (UTC) Date: Mon, 3 Jul 2017 17:36:00 +0000 (UTC) From: "Mark R (JIRA)" To: notifications@ant.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (IVY-1562) Ivy files cannot reference parent module locations of files with a literal "%2F" in them MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 03 Jul 2017 17:36:05 -0000 [ https://issues.apache.org/jira/browse/IVY-1562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16072756#comment-16072756 ] Mark R edited comment on IVY-1562 at 7/3/17 5:35 PM: ----------------------------------------------------- It does with work the latest build (602). After some investigation it seems it was fixed with IVY-1448 - https://github.com/apache/ant-ivy/commit/b308d598b603056e3ff7e8d53e099b677d4e8d38. It still may be a good idea to add unit tests for this specific case. XmlModuleDescriptorParser.parseParentModuleOnFilesystem changed: {code:java} return parser.parseDescriptor(getSettings(), file.toURL(), res, isValidate()); {code} became {code:java} return parser.parseDescriptor(getSettings(), file.toURI().toURL(), res, isValidate()); {code} The file.toURL method is actually deprecated with this note: {noformat} Deprecated. This method does not automatically escape characters that are illegal in URLs. It is recommended that new code convert an abstract pathname into a URL by first converting it into a URI, via the toURI method, and then converting the URI into a URL via the URI.toURL method. {noformat} Using toURI().toURL() causes it to correctly be passed in as feature%252Ftesting of which FileURLConnection was able to understand. was (Author: mrichar2): It does with work the latest build (602). After some investigation it seems it was fixed with IVY-1448 - https://github.com/apache/ant-ivy/commit/b308d598b603056e3ff7e8d53e099b677d4e8d38. It still may be a good idea to add unit tests for this specific case. XmlModuleDescriptorParser.parseParentModuleOnFilesystem changed: {code:java} return parser.parseDescriptor(getSettings(), file.toURL(), res, isValidate()); {code} became {code:java} return parser.parseDescriptor(getSettings(), file.toURI().toURL(), res, isValidate()); {code} The file.toURL method is actually deprecated with this note: {noformat} Deprecated. This method does not automatically escape characters that are illegal in URLs. It is recommended that new code convert an abstract pathname into a URL by first converting it into a URI, via the toURI method, and then converting the URI into a URL via the URI.toURL method. {noformat} Using toURI().toURL() causes it to correctly be passed in as feature%252Ftesting. > Ivy files cannot reference parent module locations of files with a literal "%2F" in them > ---------------------------------------------------------------------------------------- > > Key: IVY-1562 > URL: https://issues.apache.org/jira/browse/IVY-1562 > Project: Ivy > Issue Type: Bug > Affects Versions: 2.4.0 > Reporter: Mark R > Assignee: jaikiran pai > > The Jenkins [Pipeline Multibranch Plugin|https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Multibranch+Plugin] creates a Jenkins workspace directory structure for each branch in a repository. If the repository branch name contains a '/' it is encoded as '%2F'. > It seems the extends element under the info element is not handling the encoding correctly. Consider the following: > Workspace: > /feature%2Ftesting/ivy.xml > /feature%2Ftesting/folder1/myparentmodule-ivy.xml > {code:java} > > > > > ... > {code} > If I hard code the location to be file:/.../feature%2Ftesting/folder1/myparentmodule-ivy.xml > I get this exception (location in build file is calling an ivy retrieve): > {noformat} > ...\feature%2Ftesting\my-build-file.xml:427: syntax errors in ivy file: java.text.ParseException: Problem occurred while parsing ivy file: Unable to parse included ivy file for myorg#myparentmodule;1.0.0 in file:/C:/.../feature%252Ftesting/remote/ivy.xml > at org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser$Parser.parse(XmlModuleDescriptorParser.java:294) > at org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser.parseDescriptor(XmlModuleDescriptorParser.java:119) > at org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser.parseDescriptor(AbstractModuleDescriptorParser.java:48) > at org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:187) > at org.apache.ivy.Ivy.resolve(Ivy.java:508) > at org.apache.ivy.ant.IvyResolve.doExecute(IvyResolve.java:330) > at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:271) > at org.apache.ivy.ant.IvyPostResolveTask.ensureResolved(IvyPostResolveTask.java:228) > at org.apache.ivy.ant.IvyPostResolveTask.prepareAndCheck(IvyPostResolveTask.java:179) > at org.apache.ivy.ant.IvyRetrieve.doExecute(IvyRetrieve.java:88) > at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:271) > at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292) > at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) > at org.apache.tools.ant.Task.perform(Task.java:348) > at org.apache.tools.ant.Target.execute(Target.java:435) > at org.apache.tools.ant.Target.performTasks(Target.java:456) > at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393) > at org.apache.tools.ant.Project.executeTarget(Project.java:1364) > at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) > at org.apache.tools.ant.Project.executeTargets(Project.java:1248) > at org.apache.tools.ant.Main.runBuild(Main.java:851) > at org.apache.tools.ant.Main.startAnt(Main.java:235) > at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) > at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) > {noformat} > This happens because the %2F is translated into a slash (/) which then when treated as a file in windows becomes a backslash (\). > I should be able to get it to work by instead encoding the % by setting location=file:/.../feature%252Ftesting/folder1/myparentmodule-ivy.xml. However, I get the same exception. > The reason seems to come from the encoding getting lost at XmlModuleDescriptorParser.parseParentModuleOnFilesystem. Running through the debugger: > input: > {noformat} > file:/.../feature%252Ftesting/folder1/myparentmodule-ivy.xml > {noformat} > results in parser.parseDescriptor getting called with file.toURL = > {noformat} > file:/.../feature%2Ftesting/folder1/myparentmodule-ivy.xml > {noformat} > Instead of > {noformat} > file:/.../feature%252Ftesting/folder1/myparentmodule-ivy.xml > {noformat} > Observe that the %252F become %2F. This results in the same exception as above. A FileNotFoundException is thrown because the FileURLConnection class translates the %2F to be the system slash (\) and so it tries the folder 'feature\testing'. Were the %252F not lost it would correctly decode to use the literal value of '%2F' and try the folder 'feature%2Ftesting' > Note trying %25252F does not work as an exception is thrown ("Parent module doesn't exist on the filesystem...") > Here is the code in question: > https://github.com/apache/ant-ivy/blob/master/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java#L673 -- This message was sent by Atlassian JIRA (v6.4.14#64029)