ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject svn commit: r640118 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java
Date Sat, 22 Mar 2008 23:05:38 GMT
Author: peterreilly
Date: Sat Mar 22 16:05:37 2008
New Revision: 640118

URL: http://svn.apache.org/viewvc?rev=640118&view=rev
Log:
fix for 43799: ManifestClassPath cannot traverse system root

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=640118&r1=640117&r2=640118&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Sat Mar 22 16:05:37 2008
@@ -52,6 +52,9 @@
 
  * <touch> task couldn't differentiate between "no resources specified" and "no resources
    matched."  Bugzilla report 43799.
+
+ * ManifestClassPath throws when a relative path would traverse the file system root. Bugzilla
+   report 44499.
    
 Other changes:
 --------------

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=640118&r1=640117&r2=640118&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 Sat Mar 22
16:05:37 2008
@@ -75,7 +75,10 @@
         File currDir = dir;
         String[] dirs = new String[maxParentLevels + 1];
         for (int i = 0; i < maxParentLevels + 1; ++i) {
-            dirs[i] = currDir.getAbsolutePath() + File.separatorChar;
+            dirs[i] = currDir.getAbsolutePath();
+            if (!dirs[i].equals("" + File.separatorChar)) {
+                dirs[i] = dirs[i] + File.separatorChar;
+            }
             currDir = currDir.getParentFile();
             if (currDir == null) {
                 maxParentLevels = i + 1;
@@ -95,7 +98,7 @@
             // Find the longest prefix shared by the current file
             // and the reference directory.
             String relPath = null;
-            for (int j = 0; j <= maxParentLevels; ++j) {
+            for (int j = 0; j <= maxParentLevels && j < dirs.length; ++j) {
                 String dir = dirs[j];
                 if (!fullPath.startsWith(dir)) {
                     continue;



Mime
View raw message