You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/02/24 18:13:27 UTC

svn commit: r380716 - /incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java

Author: gnodet
Date: Fri Feb 24 09:13:21 2006
New Revision: 380716

URL: http://svn.apache.org/viewcvs?rev=380716&view=rev
Log:
SM-329: NullPointerException when reinstalling a component after a previous uninstall
Patch submitted by David Grigglestone

Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java?rev=380716&r1=380715&r2=380716&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java Fri Feb 24 09:13:21 2006
@@ -488,17 +488,26 @@
             File file = getComponentRootDirectory(componentName);
             if (file != null) {
                 if (!FileUtil.deleteFile(file)) {
-                    log.warn("Failed to remove directory structure for Component: " + componentName);
+                    log.warn("Failed to remove directory structure for component [version]: " + componentName + " [" + file.getName() + ']');
                 }
                 else {
-                    log.info("Removed Component Root directory for " + componentName);
+                    log.info("Removed directory structure for component [version]: " + componentName + " [" + file.getName() + ']');
+                    File parent = file.getParentFile();
+                    if (parent.list().length == 0) {
+                        if (!FileUtil.deleteFile(parent)) {
+                            log.warn("Failed to remove root directory for component: " + componentName);
+                        }
+                        else {
+                            log.info("Removed root directory structure for component: " + componentName);
+                        }
+                    }
                 }
             }
         }
         catch (IOException e) {
-            log.warn("Failed to remove directory structure for Component: " + componentName, e);
+            log.warn("Failed to remove directory structure for component: " + componentName, e);
         }
-    }
+    } 
     
     /**
      * create a shared library directory