diff options
author | Olivier Lamy <olamy@apache.org> | 2014-04-16 19:48:53 +1000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2014-04-16 19:48:53 +1000 |
commit | 65bcbc9d45b654b66a188c69b55cec2e00037268 (patch) | |
tree | e05b1f32c62c2385f621bb85549ce4951841fa1d /archiva-modules/archiva-web | |
parent | ec1e655c9d996f20bd231b21505a6df865d8a1f7 (diff) | |
download | archiva-65bcbc9d45b654b66a188c69b55cec2e00037268.tar.gz archiva-65bcbc9d45b654b66a188c69b55cec2e00037268.zip |
do the same as FileUtils.copyFile do
Diffstat (limited to 'archiva-modules/archiva-web')
2 files changed, 6 insertions, 2 deletions
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 ) { |