aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTest.java25
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java4
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java4
3 files changed, 21 insertions, 12 deletions
diff --git a/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTest.java b/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTest.java
index e72704e35..cc63e0c3a 100644
--- a/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTest.java
+++ b/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTest.java
@@ -37,6 +37,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
import java.util.concurrent.atomic.AtomicInteger;
//import org.apache.commons.io.IOUtils;
@@ -90,7 +91,8 @@ public class DefaultFileLockManagerTest
try
{
lock.getFile().delete();
- Files.copy( largeJar.toPath(), lock.getFile().toPath() );
+ Files.copy( largeJar.toPath(), lock.getFile().toPath(), StandardCopyOption.REPLACE_EXISTING,
+ StandardCopyOption.COPY_ATTRIBUTES );
}
finally
{
@@ -108,7 +110,8 @@ public class DefaultFileLockManagerTest
try
{
lock.getFile().delete();
- Files.copy( largeJar.toPath(), lock.getFile().toPath() );
+ Files.copy( largeJar.toPath(), lock.getFile().toPath(), StandardCopyOption.REPLACE_EXISTING,
+ StandardCopyOption.COPY_ATTRIBUTES );
}
finally
{
@@ -144,7 +147,8 @@ public class DefaultFileLockManagerTest
try
{
lock.getFile().delete();
- Files.copy( largeJar.toPath(), lock.getFile().toPath() );
+ Files.copy( largeJar.toPath(), lock.getFile().toPath(), StandardCopyOption.REPLACE_EXISTING,
+ StandardCopyOption.COPY_ATTRIBUTES );
}
finally
{
@@ -162,7 +166,8 @@ public class DefaultFileLockManagerTest
try
{
lock.getFile().delete();
- Files.copy( largeJar.toPath(), lock.getFile().toPath() );
+ Files.copy( largeJar.toPath(), lock.getFile().toPath(), StandardCopyOption.REPLACE_EXISTING,
+ StandardCopyOption.COPY_ATTRIBUTES );
}
finally
{
@@ -179,8 +184,7 @@ public class DefaultFileLockManagerTest
Lock lock = fileLockManager.readFileLock( this.file );
try
{
- Files.copy( lock.getFile().toPath(),
- new FileOutputStream( File.createTempFile( "foo", ".jar" ) ) );
+ Files.copy( lock.getFile().toPath(), new FileOutputStream( File.createTempFile( "foo", ".jar" ) ) );
}
finally
{
@@ -198,7 +202,8 @@ public class DefaultFileLockManagerTest
try
{
lock.getFile().delete();
- Files.copy( largeJar.toPath(), lock.getFile().toPath() );
+ Files.copy( largeJar.toPath(), lock.getFile().toPath(), StandardCopyOption.REPLACE_EXISTING,
+ StandardCopyOption.COPY_ATTRIBUTES );
}
finally
{
@@ -233,7 +238,8 @@ public class DefaultFileLockManagerTest
try
{
lock.getFile().delete();
- Files.copy( largeJar.toPath(), lock.getFile().toPath() );
+ Files.copy( largeJar.toPath(), lock.getFile().toPath(), StandardCopyOption.REPLACE_EXISTING,
+ StandardCopyOption.COPY_ATTRIBUTES );
}
finally
{
@@ -250,8 +256,7 @@ public class DefaultFileLockManagerTest
Lock lock = fileLockManager.readFileLock( this.file );
try
{
- Files.copy( lock.getFile().toPath(),
- new FileOutputStream( File.createTempFile( "foo", ".jar" ) ) );
+ Files.copy( lock.getFile().toPath(), new FileOutputStream( File.createTempFile( "foo", ".jar" ) ) );
}
finally
{
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
index 4fdb5f646..0aa6660c0 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
@@ -90,6 +90,7 @@ import javax.ws.rs.core.Response;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -530,7 +531,8 @@ public class DefaultRepositoriesService
private void copyFile( File sourceFile, File targetPath, String targetFilename, boolean fixChecksums )
throws IOException
{
- Files.copy( sourceFile.toPath(), new File( targetPath, targetFilename ).toPath() );
+ Files.copy( sourceFile.toPath(), new File( targetPath, targetFilename ).toPath(), StandardCopyOption.REPLACE_EXISTING,
+ StandardCopyOption.COPY_ATTRIBUTES );
if ( fixChecksums )
{
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java
index c232e03fa..1719a7188 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java
@@ -70,6 +70,7 @@ import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -577,7 +578,8 @@ public class DefaultFileUploadService
throws IOException
{
- Files.copy( sourceFile.toPath(), new File( targetPath, targetFilename ).toPath() );
+ Files.copy( sourceFile.toPath(), new File( targetPath, targetFilename ).toPath(), StandardCopyOption.REPLACE_EXISTING,
+ StandardCopyOption.COPY_ATTRIBUTES );
if ( fixChecksums )
{