[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [collector/master] Make tests for PersistenceUtils pass.



commit 234b040259540e2cec1267eaf7843a2144adf973
Author: iwakeh <iwakeh@xxxxxxxxxxxxxx>
Date:   Tue Oct 25 17:45:48 2016 +0200

    Make tests for PersistenceUtils pass.
---
 src/main/java/org/torproject/collector/persist/PersistenceUtils.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/main/java/org/torproject/collector/persist/PersistenceUtils.java b/src/main/java/org/torproject/collector/persist/PersistenceUtils.java
index 924b7bb..8133451 100644
--- a/src/main/java/org/torproject/collector/persist/PersistenceUtils.java
+++ b/src/main/java/org/torproject/collector/persist/PersistenceUtils.java
@@ -39,6 +39,9 @@ public class PersistenceUtils {
             outputPath.toFile().getName() + ".tmp").toPath();
         if (Files.exists(outputPath) && StandardOpenOption.APPEND == option) {
           Files.copy(outputPath, tmpPath, StandardCopyOption.REPLACE_EXISTING);
+        } else if (Files.exists(outputPath)
+            && StandardOpenOption.CREATE_NEW == option) {
+          return false;
         }
       }
       StandardOpenOption appendOption = option;

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits