Browse Source

fix for 43799: ManifestClassPath cannot traverse system root

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@640118 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 17 years ago
parent
commit
1cb20ea690
2 changed files with 8 additions and 2 deletions
  1. +3
    -0
      WHATSNEW
  2. +5
    -2
      src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java

+ 3
- 0
WHATSNEW View File

@@ -52,6 +52,9 @@ Fixed bugs:

* <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:
--------------


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

@@ -75,7 +75,10 @@ public class ManifestClassPath extends Task {
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 @@ public class ManifestClassPath extends Task {
// 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;


Loading…
Cancel
Save