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

[tor-commits] [collector/master] Index should not record temporary files,



commit 6703873d0079becefb77ade1483fee2c7ce28e6d
Author: iwakeh <iwakeh@xxxxxxxxxxxxxx>
Date:   Wed Oct 19 16:21:33 2016 +0200

    Index should not record temporary files,
    i.e. files starting with "." or ending with ".tmp".
---
 CHANGELOG.md                                                      | 1 +
 src/main/java/org/torproject/collector/index/CreateIndexJson.java | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a81b1a6..a19145f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@
    - Add enum for descriptor type annotations.
    - Add modular file persistence to write descriptors to the out/ and
      recent/ subdirectories..
+   - Exclude temporary files from index.json* files.
 
 # Changes in version 1.0.2 - 2016-10-07
 
diff --git a/src/main/java/org/torproject/collector/index/CreateIndexJson.java b/src/main/java/org/torproject/collector/index/CreateIndexJson.java
index 6207a39..4db4a7b 100644
--- a/src/main/java/org/torproject/collector/index/CreateIndexJson.java
+++ b/src/main/java/org/torproject/collector/index/CreateIndexJson.java
@@ -175,7 +175,8 @@ public class CreateIndexJson extends CollecTorMain {
       return null;
     }
     for (File fileOrDirectory : fileList) {
-      if (fileOrDirectory.getName().startsWith(".")) {
+      if (fileOrDirectory.getName().startsWith(".")
+          || fileOrDirectory.getName().endsWith(".tmp")) {
         continue;
       }
       if (fileOrDirectory.isFile()) {



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