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

karsten at torproject.org karsten at torproject.org
Tue Oct 25 18:16:13 UTC 2016


commit 234b040259540e2cec1267eaf7843a2144adf973
Author: iwakeh <iwakeh at torproject.org>
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;



More information about the tor-commits mailing list