Commits

Sebastian Sdorra  committed 78a2d5a Merge

merge with branch issue-476

  • Participants
  • Parent commits 4afe394, 651c571

Comments (0)

Files changed (1)

File scm-core/src/main/java/sonia/scm/util/IOUtil.java

   }
 
   /**
-   *   Method description
+   * Method description
    *
    *
-   *   @param file
+   * @param file
    * @param silent
    *
-   *   @throws IOException
+   * @throws IOException
    */
   public static void delete(File file, boolean silent) throws IOException
   {
       {
         for (File child : children)
         {
-          delete(child);
+          delete(child, silent);
         }
       }
     }
 
-    if (!file.delete())
+    for (int i = 20; !file.delete(); i--)
     {
-      String message = "could not delete file ".concat(file.getPath());
+      if (i <= 20)
+      {
+        String message = "could not delete file ".concat(file.getPath());
 
-      if (silent)
+        if (silent)
+        {
+          logger.error(message);
+        }
+        else
+        {
+          throw new IOException(message);
+        }
+      }
+
+      try
       {
-        logger.error(message);
+        logger.warn("sleep 250ms, because of delete for file {} failed", file);
+        Thread.sleep(250);
       }
-      else
+      catch (InterruptedException ex)
       {
-        throw new IOException(message);
+        logger.warn("sleep of delete method interrupted", ex);
       }
     }
   }