]> source.dussan.org Git - archiva.git/commitdiff
Fixing locking tests on windows
authorMartin Stockhammer <martin_s@apache.org>
Sun, 16 Apr 2017 20:17:16 +0000 (22:17 +0200)
committerMartin Stockhammer <martin_s@apache.org>
Sun, 16 Apr 2017 20:17:16 +0000 (22:17 +0200)
archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTimeoutTest.java

index cd2cba209c511133a16f63fddc7767a1eafd24ca..666efee1881dcc518375d539c5d8c87b26f83cae 100644 (file)
@@ -30,6 +30,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import javax.inject.Inject;
 import javax.inject.Named;
 import java.io.File;
+import java.io.IOException;
 import java.nio.file.FileSystemException;
 import java.nio.file.Files;
 import java.nio.file.StandardCopyOption;
@@ -72,7 +73,13 @@ public class DefaultFileLockManagerTimeoutTest
 
                 Lock lock = fileLockManager.writeFileLock(file);
 
-                Files.copy(largeJar.toPath(), lock.getFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
+                try {
+                    Files.copy(largeJar.toPath(), lock.getFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
+                } catch (IOException e) {
+                    logger.warn("Copy failed "+e.getMessage());
+                    // On windows a FileSystemException is thrown
+                    // We ignore this
+                }
 
                 lock = fileLockManager.writeFileLock(file);
             } catch (FileSystemException ex) {