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

[tor-commits] [webstats/master] Stop truncating files when merging new lines into them.



commit 4096c6aeae0ad61e6b3d7df5ded0171a1c68e83f
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Thu Aug 9 11:05:32 2012 +0200

    Stop truncating files when merging new lines into them.
    
    When merging newly sanitized lines into an existing file, we stopped as
    soon as the existing file ran out of lines.  We must also add the
    remaining new sanitized lines.
---
 src/org/torproject/webstats/Main.java |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/org/torproject/webstats/Main.java b/src/org/torproject/webstats/Main.java
index 1aa02d4..3be2c92 100644
--- a/src/org/torproject/webstats/Main.java
+++ b/src/org/torproject/webstats/Main.java
@@ -367,6 +367,9 @@ public class Main {
         }
         bw.write(line + "\n");
       }
+      while (cachedLinesListPosition < totalCachedLines) {
+        bw.write(cachedLinesList.get(cachedLinesListPosition++) + "\n");
+      }
       br.close();
       bw.close();
     } catch (IOException e) {

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