Browse Source

fix boundary checking problem similiar to the one fixed for bug report 4290

Actually this wouldn't throw an ArrayIndexOutOuBounds- but a
BuildException as FileList.getFiles barfs out on empty lists, but that
way it is more consistent.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271456 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
79a5919664
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/DependSet.java

+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/DependSet.java View File

@@ -231,6 +231,7 @@ public class DependSet extends MatchingTask {
log("Warning: "+targetFiles[i]+" modified in the future.",
Project.MSG_WARN);
}

if (oldestTarget == null ||
dest.lastModified() < oldestTargetTime) {
oldestTargetTime = dest.lastModified();
@@ -256,8 +257,7 @@ public class DependSet extends MatchingTask {
FileList sourceFL = (FileList) enumSourceLists.nextElement();
String[] sourceFiles = sourceFL.getFiles(project);

int i = 0;
do {
for (int i=0; upToDate && i < sourceFiles.length; i++) {
File src = new File(sourceFL.getDir(project), sourceFiles[i]);

if (src.lastModified() > now) {
@@ -276,7 +276,7 @@ public class DependSet extends MatchingTask {
log(oldestTarget + " is out of date with respect to " +
sourceFiles[i], Project.MSG_VERBOSE);
}
} while (upToDate && (++i < sourceFiles.length) );
}
}
}



Loading…
Cancel
Save