ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Get.java
Date Mon, 29 Apr 2002 15:04:21 GMT
bodewig     02/04/29 08:04:21

  Modified:    src/main/org/apache/tools/ant/taskdefs Get.java
  Log:
  Diane has volunteered me, errm, I mean, remove dest if <get> fails.
  
  Revision  Changes    Path
  1.24      +8 -0      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Get.java
  
  Index: Get.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Get.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Get.java	29 Apr 2002 11:19:35 -0000	1.23
  +++ Get.java	29 Apr 2002 15:04:21 -0000	1.24
  @@ -208,6 +208,7 @@
               }
   
               FileOutputStream fos = new FileOutputStream(dest);
  +            boolean finished = false;
               try {
                   byte[] buffer = new byte[100 * 1024];
                   int length;
  @@ -221,11 +222,18 @@
                   if (verbose) {
                       System.out.println();
                   }
  +                finished = true;
               } finally {
                   if (fos != null) {
                       fos.close();
                   }
                   is.close();
  +                // we have started to (over)write dest, but failed.
  +                // Try to delete the garbage we'd otherwise leave
  +                // behind.
  +                if (!finished) {
  +                    dest.delete();
  +                }
               }
   
               //if (and only if) the use file time option is set, then
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message