From a9c761db3565b8e68838c547c3ae79f59f886330 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 31 Dec 2013 14:39:16 +0000 Subject: [PATCH] =?UTF-8?q?manifestclasspath=20uses=20wrong=20path=20for?= =?UTF-8?q?=20parent=20directory=20of=20jar.=20=20Patch=20by=20Gr=C3=A9goi?= =?UTF-8?q?re=20Vatry.=20=20PR=2055049?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1554524 13f79535-47bb-0310-9956-ffa450edef68 --- CONTRIBUTORS | 1 + WHATSNEW | 4 +++ contributors.xml | 4 +++ .../tools/ant/taskdefs/ManifestClassPath.java | 6 +++- .../taskdefs/manifestclasspath-test.xml | 30 +++++++++++++++++++ 5 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/tests/antunit/taskdefs/manifestclasspath-test.xml diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 009bb30bc..f019bb923 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -138,6 +138,7 @@ Glenn Twiggs Greg Nelson Greg Roodt Greg Schueler +Grégoire Vatry Günther Kögel Harish Prabandham Haroon Rafique diff --git a/WHATSNEW b/WHATSNEW index 370ce7956..3dc0e0908 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -21,6 +21,10 @@ Fixed bugs: where another thread already created the same directory. Bugzilla Report 55290 + * created '/' rather than './' for the parent + directory of the given jarfile. + Bugzilla Report 55049 + Other changes: -------------- diff --git a/contributors.xml b/contributors.xml index e3a1bcee2..ffb452b43 100644 --- a/contributors.xml +++ b/contributors.xml @@ -576,6 +576,10 @@ Greg Schueler + + Grégoire + Vatry + Günther Kögel diff --git a/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java b/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java index 497c0a195..84c21c1e4 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java +++ b/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java @@ -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 diff --git a/src/tests/antunit/taskdefs/manifestclasspath-test.xml b/src/tests/antunit/taskdefs/manifestclasspath-test.xml new file mode 100644 index 000000000..612990b61 --- /dev/null +++ b/src/tests/antunit/taskdefs/manifestclasspath-test.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + +