Browse Source

fix tests broken by changed exception message of svn revision 685593

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@694254 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 17 years ago
parent
commit
cd517c2881
4 changed files with 10 additions and 6 deletions
  1. +5
    -3
      src/main/org/apache/tools/ant/DirectoryScanner.java
  2. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/Copy.java
  3. +2
    -1
      src/main/org/apache/tools/ant/types/AbstractFileSet.java
  4. +1
    -1
      src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java

+ 5
- 3
src/main/org/apache/tools/ant/DirectoryScanner.java View File

@@ -171,6 +171,7 @@ public class DirectoryScanner
}; };


public static final int MAX_LEVELS_OF_SYMLINKS = 1; public static final int MAX_LEVELS_OF_SYMLINKS = 1;
public static final String DOES_NOT_EXIST_POSTFIX = " does not exist.";


/** Helper. */ /** Helper. */
private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
@@ -834,8 +835,9 @@ public class DirectoryScanner
} else { } else {
if (!basedir.exists()) { if (!basedir.exists()) {
if (errorOnMissingDir) { if (errorOnMissingDir) {
illegal = new IllegalStateException(
"basedir " + basedir + " does not exist.");
illegal = new IllegalStateException("basedir "
+ basedir
+ DOES_NOT_EXIST_POSTFIX);
} else { } else {
// Nothing to do - basedir does not exist // Nothing to do - basedir does not exist
return; return;
@@ -1100,7 +1102,7 @@ public class DirectoryScanner
String[] newfiles = list(dir); String[] newfiles = list(dir);
if (newfiles == null) { if (newfiles == null) {
if (!dir.exists()) { if (!dir.exists()) {
throw new BuildException(dir + " doesn't exist.");
throw new BuildException(dir + DOES_NOT_EXIST_POSTFIX);
} else if (!dir.isDirectory()) { } else if (!dir.isDirectory()) {
throw new BuildException(dir + " is not a directory."); throw new BuildException(dir + " is not a directory.");
} else { } else {


+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/Copy.java View File

@@ -434,7 +434,8 @@ public class Copy extends Task {
ds = fs.getDirectoryScanner(getProject()); ds = fs.getDirectoryScanner(getProject());
} catch (BuildException e) { } catch (BuildException e) {
if (failonerror if (failonerror
|| !getMessage(e).endsWith(" not found.")) {
|| !getMessage(e).endsWith(DirectoryScanner
.DOES_NOT_EXIST_POSTFIX)) {
throw e; throw e;
} else { } else {
log("Warning: " + getMessage(e), Project.MSG_ERR); log("Warning: " + getMessage(e), Project.MSG_ERR);


+ 2
- 1
src/main/org/apache/tools/ant/types/AbstractFileSet.java View File

@@ -446,7 +446,8 @@ public abstract class AbstractFileSet extends DataType
} }
if (!dir.exists() && errorOnMissingDir) { if (!dir.exists() && errorOnMissingDir) {
throw new BuildException(dir.getAbsolutePath() throw new BuildException(dir.getAbsolutePath()
+ " does not exist.");
+ DirectoryScanner
.DOES_NOT_EXIST_POSTFIX);
} }
if (!dir.isDirectory() && dir.exists()) { if (!dir.isDirectory() && dir.exists()) {
throw new BuildException(dir.getAbsolutePath() throw new BuildException(dir.getAbsolutePath()


+ 1
- 1
src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java View File

@@ -153,7 +153,7 @@ public class CopyTest extends BuildFileTest {


public void testMissingDirBail() { public void testMissingDirBail() {
expectBuildException("testMissingDirBail", "not-there doesn't exist"); expectBuildException("testMissingDirBail", "not-there doesn't exist");
assertTrue(getBuildException().getMessage().endsWith(" not found."));
assertTrue(getBuildException().getMessage().endsWith(" does not exist."));
} }
public void testFileResourcePlain() { public void testFileResourcePlain() {


Loading…
Cancel
Save