You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by "jaikiran pai (JIRA)" <ji...@apache.org> on 2017/06/30 07:49:00 UTC

[jira] [Commented] (IVY-1562) Ivy files cannot reference parent module locations of files with a literal "%2F" in them

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

jaikiran pai commented on IVY-1562:
-----------------------------------

[~mrichar2], there has been a minor but relevant change in this piece of code recently. Can you give this a try with our latest upstream build that's available here https://builds.apache.org/job/Ivy/lastSuccessfulBuild/. You can use either the .zip or .tar.gz and install it just like you would install the regular released Ivy version.

You should be able to get it working by just using the following in your ivy.xml:

{code}
<extends organisation="myorg" module="myparentmodule" revision="1.0.0" location="C:/.../feature%2Ftesting/folder1/myparentmodule-ivy.xml"/>
{code}

> 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
>
> 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}
> <ivy-module version="2.0">
>     <info organisation="myorg" module="mymodule" revision="1.0.0">
>         <extends organisation="myorg" module="myparentmodule" revision="1.0.0" location="file:/.../feature%2Ftesting/folder1/myparentmodule-ivy.xml"/>
>     </info>
>     ...
> {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)