commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r759339 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
Date Fri, 27 Mar 2009 20:45:59 GMT
Author: sebb
Date: Fri Mar 27 20:45:58 2009
New Revision: 759339

URL: http://svn.apache.org/viewvc?rev=759339&view=rev
Log:
Recursive delete of temporary directories

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=759339&r1=759338&r2=759339&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
Fri Mar 27 20:45:58 2009
@@ -76,10 +76,19 @@
         String[] s = f.list();
         if (s != null) {
             for (int i = 0; i < s.length; i++) {
-                new File(f, s[i]).delete();
+                final File file = new File(f, s[i]);
+                if (file.isDirectory()){
+                    rmdir(file);
+                }
+                boolean ok = file.delete();
+                if (!ok && file.exists()){
+                    System.out.println("Failed to delete "+s[i]+" in "+f.getPath());
+                }
             }
         }
-        f.delete();
+        if (!f.delete()){
+            throw new Error("Failed to delete "+f.getPath());
+        }
     }
 
     /**
@@ -240,5 +249,6 @@
             }
         }
         assertEquals(0, expected.size());
+        rmdir(result);
     }
 }



Mime
View raw message