ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Copyfile.java Copydir.java
Date Mon, 11 Sep 2000 10:15:05 GMT
conor       00/09/11 03:15:03

  Modified:    src/main/org/apache/tools/ant/taskdefs Copyfile.java
                        Copydir.java
  Log:
  Add error reporting to copyfile and copydir.
  
  Thanks to Diane Holt <holtdl@yahoo.com> for pointing that out.
  
  Revision  Changes    Path
  1.5       +17 -4     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copyfile.java
  
  Index: Copyfile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copyfile.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Copyfile.java	2000/08/17 15:40:19	1.4
  +++ Copyfile.java	2000/09/11 10:14:59	1.5
  @@ -72,16 +72,16 @@
       private boolean filtering = false;
       private boolean forceOverwrite = false;
    
  -    public void setSrc(String src) {
  -        srcFile = project.resolveFile(src);
  +    public void setSrc(File src) {
  +        srcFile = src;
       }
   
       public void setForceoverwrite(String force) {
           forceOverwrite = Project.toBoolean(force);
       }
   
  -    public void setDest(String dest) {
  -        destFile = project.resolveFile(dest);
  +    public void setDest(File dest) {
  +        destFile = dest;
       }
   
       public void setFiltering(String filter) {
  @@ -89,6 +89,19 @@
       }
   
       public void execute() throws BuildException {
  +        if (srcFile == null) {
  +            throw new BuildException("The src attribute must be present.", location);
  +        }
  +        
  +        if (!srcFile.exists()) {
  +            throw new BuildException("src " + srcFile.toString()
  +                                     + " does not exist.", location);
  +        }
  +
  +        if (destFile == null) {
  +            throw new BuildException("The dest attribute must be present.", location);
  +        }
  +        
           if (forceOverwrite || srcFile.lastModified() > destFile.lastModified()) {
               try {
                   project.copyFile(srcFile, destFile, filtering, forceOverwrite);
  
  
  
  1.12      +8 -4      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java
  
  Index: Copydir.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Copydir.java	2000/08/03 09:43:18	1.11
  +++ Copydir.java	2000/09/11 10:15:00	1.12
  @@ -74,12 +74,12 @@
       private boolean forceOverwrite = false;
       private Hashtable filecopyList = new Hashtable();
   
  -    public void setSrc(String src) {
  -        srcDir = project.resolveFile(src);
  +    public void setSrc(File src) {
  +        srcDir = src;
       }
   
  -    public void setDest(String dest) {
  -        destDir = project.resolveFile(dest);
  +    public void setDest(File dest) {
  +        destDir = dest;
       }
   
       public void setFiltering(String filter) {
  @@ -103,6 +103,10 @@
           if (!srcDir.exists()) {
               throw new BuildException("srcdir "+srcDir.toString()
                                        +" does not exist!", location);
  +        }
  +
  +        if (destDir == null) {
  +            throw new BuildException("The dest attribute must be set.", location);
           }
   
           DirectoryScanner ds = super.getDirectoryScanner(srcDir);
  
  
  

Mime
View raw message