From 79a591966485337a98ec87cfcda01218969b73da Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Wed, 20 Feb 2002 16:48:00 +0000 Subject: [PATCH] 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 --- src/main/org/apache/tools/ant/taskdefs/DependSet.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/DependSet.java b/src/main/org/apache/tools/ant/taskdefs/DependSet.java index 689300476..84ccdaf37 100644 --- a/src/main/org/apache/tools/ant/taskdefs/DependSet.java +++ b/src/main/org/apache/tools/ant/taskdefs/DependSet.java @@ -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) ); + } } }