geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwo...@apache.org
Subject svn commit: r1141361 - in /geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle: BundleRecorderGBean.java Utils.java
Date Thu, 30 Jun 2011 02:15:49 GMT
Author: rwonly
Date: Thu Jun 30 02:15:49 2011
New Revision: 1141361

URL: http://svn.apache.org/viewvc?rev=1141361&view=rev
Log:
GERONIMO-5764 when delete the bundles, delete the parent folder if it is empty

Modified:
    geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/BundleRecorderGBean.java
    geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/Utils.java

Modified: geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/BundleRecorderGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/BundleRecorderGBean.java?rev=1141361&r1=1141360&r2=1141361&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/BundleRecorderGBean.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/BundleRecorderGBean.java
Thu Jun 30 02:15:49 2011
@@ -197,12 +197,13 @@ public class BundleRecorderGBean impleme
             
             FileUtils.recursiveDelete(versionFolder); // try delete the version folder recursively
             
-            if (artifactFolder.listFiles().length == 0) 
-                artifactFolder.delete(); // delete the artifact folder if it is empty
+            Utils.regressiveDelete(artifactFolder); // try delete the parent folder if it
is empty
         }
                 
     }
     
+    
+    
     private String getMvnLocationFromArtifact(Artifact artifact){
         if (artifact == null) return null;
         

Modified: geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/Utils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/Utils.java?rev=1141361&r1=1141360&r2=1141361&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/Utils.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-bundle-recorder/src/main/java/org/apache/geronimo/system/bundle/Utils.java
Thu Jun 30 02:15:49 2011
@@ -26,6 +26,19 @@ import java.io.IOException;
 import org.apache.geronimo.kernel.util.IOUtils;
 
 public class Utils {
+    
+    public static void regressiveDelete(File file){
+        if (file == null || !file.exists()) return;
+        
+        File parent = file.getParentFile();
+                
+        if (file.isFile() || (file.isDirectory() && file.listFiles().length ==0))
{
+            file.delete();
+            regressiveDelete(parent);
+        }
+        
+    }
+    
     public static void appendLine(File file, String line) throws IOException {
         BufferedWriter writer = null;
         try {



Mime
View raw message