commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1084594 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
Date Wed, 23 Mar 2011 14:15:17 GMT
Author: sebb
Date: Wed Mar 23 14:15:17 2011
New Revision: 1084594

URL: http://svn.apache.org/viewvc?rev=1084594&view=rev
Log:
Deletion was failing on Windows XP / Java 1.6
Seems to be timing issue, so added short pause

Modified:
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java?rev=1084594&r1=1084593&r2=1084594&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
Wed Mar 23 14:15:17 2011
@@ -86,6 +86,11 @@ public abstract class AbstractTestCase e
     }
 
     protected static void rmdir(File f) {
+        // Sometimes fails without a pause - perhaps file close is partially asynchronous?
+        try {
+            Thread.sleep(20);
+        } catch (InterruptedException e) {
+        }
         String[] s = f.list();
         if (s != null) {
             for (int i = 0; i < s.length; i++) {
@@ -99,7 +104,8 @@ public abstract class AbstractTestCase e
                 }
             }
         }
-        if (!f.delete()){
+        f.delete(); // safer to delete and check
+        if (f.exists()){
             throw new Error("Failed to delete "+f.getPath());
         }
     }



Mime
View raw message