-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
None
Some tests are failing on windows with the same reason, see some examples bellow:
java.lang.IllegalStateException: Cannot delete C:\j\workspace\jdg-8.0.x-jdg-func-ispn-testsuite-win-openjdk\4964bfc5\infinispan\core\target\infinispanTempFiles\ExpirationSingleFileStoreListenerFunctionalTest\0\defaultcache.dat owner=null permissions=[]
Java.lang.IllegalStateException: Cannot delete C:\j\workspace\jdg-8.0.x-jdg-func-ispn-testsuite-win-openjdk\4964bfc5\infinispan\core\target\infinispanTempFiles\AsyncStoreWithoutEvictionFunctionalTest\cache.dat owner=null permissions=[] at org.infinispan.commons.util.Util.recursiveDelete(Util.java:1046) at org.infinispan.commons.util.Util.recursiveDelete(Util.java:1032) at org.infinispan.commons.util.Util.recursiveFileRemove(Util.java:1022) at org.infinispan.commons.util.Util.recursiveFileRemove(Util.java:1011) at org.infinispan.persistence.support.AsyncStoreWithoutEvictionFunctionalTest.clearTempDir(AsyncStoreWithoutEvictionFunctionalTest.java:39)
java.lang.IllegalStateException: Cannot delete C:\j\workspace\jdg-8.0.x-jdg-func-ispn-testsuite-win-openjdk\4964bfc5\infinispan\core\target\infinispanTempFiles\ExpirationSingleFileStoreListenerFunctionalTest\0\defaultcache.dat owner=null permissions=[] at org.infinispan.commons.util.Util.recursiveDelete(Util.java:1046) at org.infinispan.commons.util.Util.recursiveDelete(Util.java:1032) at org.infinispan.commons.util.Util.recursiveDelete(Util.java:1032) at org.infinispan.commons.util.Util.recursiveFileRemove(Util.java:1022) at org.infinispan.commons.util.Util.recursiveFileRemove(Util.java:1011) at org.infinispan.expiration.impl.ExpirationSingleFileStoreListenerFunctionalTest.clearTempDir(ExpirationSingleFileStoreListenerFunctionalTest.java:46)
First of all we should change the old file.delete() which only return a boolean for Files.delete(file) which return an exception with a valuable information in case of the file couldn't be deleted.
The real reason for the file couldn't be delete on windows is
"the file is being used by another process"
The code bellow into org.infinispan.commons.util.Util#recursiveDelete solves the problem:
Files.walk(f.toPath()) .sorted(Comparator.reverseOrder()) .map(Path::toFile) .forEach(File::delete);