[tor-commits] [onionoo/master] Fix a bug related to writing parse history files.

karsten at torproject.org karsten at torproject.org
Sat Apr 1 18:06:02 UTC 2017


commit 897a83546fc7eb6e4d3df648222e6a405c80d379
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Fri Mar 31 15:12:41 2017 +0200

    Fix a bug related to writing parse history files.
    
    We need to create the parent directory of a parse history file before
    attempting to write to the file itself.  Looks like this broke in
    ab7c18d.
---
 src/main/java/org/torproject/onionoo/updater/DescriptorQueue.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/torproject/onionoo/updater/DescriptorQueue.java b/src/main/java/org/torproject/onionoo/updater/DescriptorQueue.java
index e2b320c..92817b1 100644
--- a/src/main/java/org/torproject/onionoo/updater/DescriptorQueue.java
+++ b/src/main/java/org/torproject/onionoo/updater/DescriptorQueue.java
@@ -192,9 +192,9 @@ class DescriptorQueue {
         this.descriptorReader.getExcludedFiles());
     excludedAndParsedFiles.putAll(this.descriptorReader.getParsedFiles());
     this.historySizeAfter = excludedAndParsedFiles.size();
+    this.historyFile.getParentFile().mkdirs();
     try (BufferedWriter bw = new BufferedWriter(new FileWriter(
         this.historyFile))) {
-      this.historyFile.getParentFile().mkdirs();
       for (Map.Entry<String, Long> e : excludedAndParsedFiles.entrySet()) {
         String absolutePath = e.getKey();
         long lastModifiedMillis = e.getValue();





More information about the tor-commits mailing list