Author: bodewig
Date: Tue Dec 31 14:39:16 2013
New Revision: 1554524

URL: http://svn.apache.org/r1554524
Log:
manifestclasspath uses wrong path for parent directory of jar.  Patch by 
Grégoire Vatry.  PR 55049

Added:
    ant/core/trunk/src/tests/antunit/taskdefs/manifestclasspath-test.xml   
(with props)
Modified:
    ant/core/trunk/CONTRIBUTORS
    ant/core/trunk/WHATSNEW
    ant/core/trunk/contributors.xml
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java

Modified: ant/core/trunk/CONTRIBUTORS
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/CONTRIBUTORS?rev=1554524&r1=1554523&r2=1554524&view=diff
==============================================================================
--- ant/core/trunk/CONTRIBUTORS (original)
+++ ant/core/trunk/CONTRIBUTORS Tue Dec 31 14:39:16 2013
@@ -138,6 +138,7 @@ Glenn Twiggs
 Greg Nelson
 Greg Roodt
 Greg Schueler
+Grégoire Vatry
 Günther Kögel
 Harish Prabandham
 Haroon Rafique

Modified: ant/core/trunk/WHATSNEW
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1554524&r1=1554523&r2=1554524&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Tue Dec 31 14:39:16 2013
@@ -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:
 --------------
 

Modified: ant/core/trunk/contributors.xml
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?rev=1554524&r1=1554523&r2=1554524&view=diff
==============================================================================
--- ant/core/trunk/contributors.xml (original)
+++ ant/core/trunk/contributors.xml Tue Dec 31 14:39:16 2013
@@ -577,6 +577,10 @@
     <last>Schueler</last>
   </name>
   <name>
+    <first>Grégoire</first>
+    <last>Vatry</last>
+  </name>
+  <name>
     <first>Günther</first>
     <last>Kögel</last>
   </name>

Modified: 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java?rev=1554524&r1=1554523&r2=1554524&view=diff
==============================================================================
--- 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java 
(original)
+++ 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java 
Tue Dec 31 14:39:16 2013
@@ -87,7 +87,11 @@ public class ManifestClassPath extends T
             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

Added: ant/core/trunk/src/tests/antunit/taskdefs/manifestclasspath-test.xml
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/manifestclasspath-test.xml?rev=1554524&view=auto
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/manifestclasspath-test.xml (added)
+++ ant/core/trunk/src/tests/antunit/taskdefs/manifestclasspath-test.xml Tue 
Dec 31 14:39:16 2013
@@ -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>

Propchange: ant/core/trunk/src/tests/antunit/taskdefs/manifestclasspath-test.xml
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to