Browse Source

Improved error messages if srcdir doesn't exist.

Submitted by: Peter Nordlund <peter.nordlund@lentus.se>


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

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

@@ -86,11 +86,13 @@ public class Copydir extends MatchingTask {


public void execute() throws BuildException { public void execute() throws BuildException {
if (srcDir == null) { if (srcDir == null) {
throw new BuildException("srcdir attribute must be set!");
throw new BuildException("srcdir attribute must be set!",
location);
} }


if (!srcDir.exists()) { if (!srcDir.exists()) {
throw new BuildException("srcdir does not exist!");
throw new BuildException("srcdir "+srcDir.toString()
+" does not exist!", location);
} }


DirectoryScanner ds = super.getDirectoryScanner(srcDir); DirectoryScanner ds = super.getDirectoryScanner(srcDir);
@@ -109,7 +111,7 @@ public class Copydir extends MatchingTask {
} catch (IOException ioe) { } catch (IOException ioe) {
String msg = "Failed to copy " + fromFile + " to " + toFile String msg = "Failed to copy " + fromFile + " to " + toFile
+ " due to " + ioe.getMessage(); + " due to " + ioe.getMessage();
throw new BuildException(msg);
throw new BuildException(msg, ioe, location);
} }
} }
} }


Loading…
Cancel
Save