archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [4/4] git commit: do the same as FileUtils.copyFile do
Date Wed, 16 Apr 2014 09:49:33 GMT
do the same as FileUtils.copyFile do


Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/65bcbc9d
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/65bcbc9d
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/65bcbc9d

Branch: refs/heads/master
Commit: 65bcbc9d45b654b66a188c69b55cec2e00037268
Parents: ec1e655
Author: Olivier Lamy <olamy@apache.org>
Authored: Wed Apr 16 19:48:53 2014 +1000
Committer: Olivier Lamy <olamy@apache.org>
Committed: Wed Apr 16 19:48:53 2014 +1000

----------------------------------------------------------------------
 .../filelock/DefaultFileLockManagerTest.java    | 25 ++++++++++++--------
 .../services/DefaultRepositoriesService.java    |  4 +++-
 .../web/api/DefaultFileUploadService.java       |  4 +++-
 3 files changed, 21 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/archiva/blob/65bcbc9d/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTest.java
----------------------------------------------------------------------
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 e72704e..cc63e0c 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
             {

http://git-wip-us.apache.org/repos/asf/archiva/blob/65bcbc9d/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
----------------------------------------------------------------------
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 4fdb5f6..0aa6660 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 )
         {

http://git-wip-us.apache.org/repos/asf/archiva/blob/65bcbc9d/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java
----------------------------------------------------------------------
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 c232e03..1719a71 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 )
         {


Mime
View raw message