Removed an "unsafe" delete method from Utils and replaced invocations to it with a "safe" delete method (one that *does* check the return code from File.delete()).

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1352147 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/DeploymentAdminImpl.java b/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/DeploymentAdminImpl.java
index 18d7f56..320f51d 100644
--- a/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/DeploymentAdminImpl.java
+++ b/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/DeploymentAdminImpl.java
@@ -272,7 +272,10 @@
         }
         finally {
             if (tempPackage != null) {
-                Utils.delete(tempPackage);
+                if (!Utils.delete(tempPackage, true)) {
+                	m_log.log(LogService.LOG_ERROR, "Could not delete temporary deployment package from disk");
+                	succeeded = false;
+                }
             }
         	if (source != null) {
         	    sendCompleteEvent(source, target, succeeded);
@@ -353,7 +356,10 @@
             }
 
             File targetPackage = m_context.getDataFile(PACKAGE_DIR + File.separator + source.getName());
-            Utils.delete(targetPackage);
+            if (!Utils.delete(targetPackage, true)) {
+            	m_log.log(LogService.LOG_ERROR, "Could not delete deployment package from disk");
+            	throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Could not delete deployment package from disk");
+            }
             
             m_packages.remove(dp.getName());
 
diff --git a/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/Utils.java b/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/Utils.java
index fd02419..2627b3b 100644
--- a/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/Utils.java
+++ b/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/Utils.java
@@ -106,18 +106,6 @@
         return result;
     }
 
-
-    public static void delete(File target) {
-        // TODO merge with #delete(File, boolean)?!
-        if (target.isDirectory()) {
-            File[] childs = target.listFiles();
-            for (int i = 0; i < childs.length; i++) {
-                delete(childs[i]);
-            }
-        }
-        target.delete();
-    }
-
     public static boolean rename(File from, File to) {
         if (!from.renameTo(to)) {
             if (copy(from, to)) {
@@ -132,7 +120,7 @@
         return true;
     }
 
-    private static boolean delete(File root, boolean deleteRoot) {
+    public static boolean delete(File root, boolean deleteRoot) {
         boolean result = true;
         if (root.isDirectory()) {
             File[] files = root.listFiles();