From b6f5be46432fdf930b62dd34fab81834a9b97b58 Mon Sep 17 00:00:00 2001 From: Conor MacNeill Date: Mon, 1 Oct 2001 07:44:42 +0000 Subject: [PATCH] Merge across fixes from 1.4 branch git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269750 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/Target.java | 23 ++++++++++++++++--- .../tools/ant/util/SourceFileScanner.java | 8 ++++++- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/main/org/apache/tools/ant/Target.java b/src/main/org/apache/tools/ant/Target.java index cda992b93..b9b861c5c 100644 --- a/src/main/org/apache/tools/ant/Target.java +++ b/src/main/org/apache/tools/ant/Target.java @@ -83,11 +83,28 @@ public class Target implements TaskContainer { public void setDepends(String depS) { if (depS.length() > 0) { StringTokenizer tok = - new StringTokenizer(depS, ",", false); + new StringTokenizer(depS, ",", true); while (tok.hasMoreTokens()) { String token = tok.nextToken().trim(); - if (!token.equals("")) { - addDependency(token); + + //Make sure the dependency is not empty string + if (token.equals("") || token.equals(",")) { + throw new BuildException( "Syntax Error: Depend attribute " + + "for target \"" + getName() + + "\" has an empty string for dependency." ); + } + + addDependency(token); + + //Make sure that depends attribute does not + //end in a , + if (tok.hasMoreTokens()) { + token = tok.nextToken(); + if (!tok.hasMoreTokens() || !token.equals(",")) { + throw new BuildException( "Syntax Error: Depend attribute " + + "for target \"" + getName() + + "\" ends with a , character" ); + } } } } diff --git a/src/main/org/apache/tools/ant/util/SourceFileScanner.java b/src/main/org/apache/tools/ant/util/SourceFileScanner.java index 1ef57f0d5..ac15e414a 100644 --- a/src/main/org/apache/tools/ant/util/SourceFileScanner.java +++ b/src/main/org/apache/tools/ant/util/SourceFileScanner.java @@ -121,7 +121,13 @@ public class SourceFileScanner { continue; } - File src = fileUtils.resolveFile(srcDir, files[i]); + File src = null; + if (srcDir == null) { + src = new File(files[i]); + } else { + src = fileUtils.resolveFile(srcDir, files[i]); + } + if (src.lastModified() > now) { task.log("Warning: "+files[i]+" modified in the future.", Project.MSG_WARN);