You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/04/26 20:52:25 UTC

[royale-compiler] branch release_practice updated: retry delete if it fails on Windows

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch release_practice
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git


The following commit(s) were added to refs/heads/release_practice by this push:
     new f5ac909  retry delete if it fails on Windows
f5ac909 is described below

commit f5ac909aa00f058827cd4b11afc977edc98d9ad9
Author: Alex Harui <ah...@apache.org>
AuthorDate: Fri Apr 26 13:49:40 2019 -0700

    retry delete if it fails on Windows
---
 .../royale/compiler/tools/annotate/AnnotateClass.java      | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/compiler-build-tools/src/main/java/org/apache/royale/compiler/tools/annotate/AnnotateClass.java b/compiler-build-tools/src/main/java/org/apache/royale/compiler/tools/annotate/AnnotateClass.java
index 43b16e9..a80b33b 100644
--- a/compiler-build-tools/src/main/java/org/apache/royale/compiler/tools/annotate/AnnotateClass.java
+++ b/compiler-build-tools/src/main/java/org/apache/royale/compiler/tools/annotate/AnnotateClass.java
@@ -138,7 +138,19 @@ public class AnnotateClass
 
             // Remove the original file.
             if(!file.delete()) {
-                throw new AnnotateClassDeleteException("Error deleting original file at: " + file.getPath());
+                // wait a bit then retry on Windows
+                if (file.exists())
+                {
+                    for (int i = 0; i < 6; i++)
+                    {
+                        Thread.sleep(500);
+                        System.gc();
+                        if (file.delete())
+                           break;
+                    }
+                    if (file.exists())
+                        throw new AnnotateClassDeleteException("Error deleting original file at: " + file.getPath());
+                }
             }
 
             // Rename the temp file to the name of the original file.