Browse Source

manifestclasspath uses wrong path for parent directory of jar. Patch by Grégoire Vatry. PR 55049

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1554524 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 11 years ago
parent
commit
a9c761db35
5 changed files with 44 additions and 1 deletions
  1. +1
    -0
      CONTRIBUTORS
  2. +4
    -0
      WHATSNEW
  3. +4
    -0
      contributors.xml
  4. +5
    -1
      src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java
  5. +30
    -0
      src/tests/antunit/taskdefs/manifestclasspath-test.xml

+ 1
- 0
CONTRIBUTORS View File

@@ -138,6 +138,7 @@ Glenn Twiggs
Greg Nelson
Greg Roodt
Greg Schueler
Grégoire Vatry
Günther Kögel
Harish Prabandham
Haroon Rafique


+ 4
- 0
WHATSNEW View File

@@ -21,6 +21,10 @@ Fixed bugs:
where another thread already created the same directory.
Bugzilla Report 55290

* <manifestclasspath> created '/' rather than './' for the parent
directory of the given jarfile.
Bugzilla Report 55049

Other changes:
--------------



+ 4
- 0
contributors.xml View File

@@ -576,6 +576,10 @@
<first>Greg</first>
<last>Schueler</last>
</name>
<name>
<first>Grégoire</first>
<last>Vatry</last>
</name>
<name>
<first>Günther</first>
<last>Kögel</last>


+ 5
- 1
src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java View File

@@ -87,7 +87,11 @@ public class ManifestClassPath extends Task {
String relPath = null;
String canonicalPath = null;
try {
relPath = FileUtils.getRelativePath(dir, pathEntry);
if (dir.equals(pathEntry)) {
relPath = ".";
} else {
relPath = FileUtils.getRelativePath(dir, pathEntry);
}

canonicalPath = pathEntry.getCanonicalPath();
// getRelativePath always uses '/' as separator, adapt


+ 30
- 0
src/tests/antunit/taskdefs/manifestclasspath-test.xml View File

@@ -0,0 +1,30 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project default="antunit"
xmlns:au="antlib:org.apache.ant.antunit">

<import file="../antunit-base.xml" />

<target name="testRelativePathOfParentDir">
<manifestclasspath property="jar.classpath"
jarfile="${basedir}/foo.jar">
<classpath path="${basedir}"/>
</manifestclasspath>
<au:assertPropertyEquals name="jar.classpath" value="./"/>
</target>
</project>

Loading…
Cancel
Save