mbenson     2004/02/16 09:26:16

  Modified:    src/main/org/apache/tools/ant/taskdefs Delete.java
  Log:
  Accommodate Windows bug encountered in both Sun and IBM JDKs.
  
  Obtained from: Java Technology Forums at http://forums.java.sun.com
  
  Revision  Changes    Path
  1.51      +6 -2      ant/src/main/org/apache/tools/ant/taskdefs/Delete.java
  
  Index: Delete.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Delete.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- Delete.java       9 Feb 2004 21:05:19 -0000       1.50
  +++ Delete.java       16 Feb 2004 17:26:16 -0000      1.51
  @@ -22,6 +22,7 @@
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.DirectoryScanner;
   import org.apache.tools.ant.Project;
  +import org.apache.tools.ant.taskdefs.condition.Os;
   import org.apache.tools.ant.types.FileSet;
   import org.apache.tools.ant.types.PatternSet;
   import org.apache.tools.ant.types.selectors.AndSelector;
  @@ -535,12 +536,15 @@
   //  protected and private methods
   //************************************************************************
       /**
  -     * Attempt to fix possible race condition when deleting
  -     * files on WinXP. If the delete does not work,
  +     * Accommodate Windows bug encountered in both Sun and IBM JDKs.
  +     * Others possible. If the delete does not work, call System.gc(),
        * wait a little and try again.
        */
       private boolean delete(File f) {
           if (!f.delete()) {
  +            if (Os.isFamily("windows")) {
  +                System.gc();
  +            }
               try {
                   Thread.sleep(DELETE_RETRY_SLEEP_MILLIS);
                   return f.delete();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to