commit 5951918390db5d48fd044e9dad9de47c69981b6b Author: Karsten Loesing karsten.loesing@gmx.net Date: Fri Jun 1 11:42:43 2012 +0200
Don't break when reading a broken history file. --- .../torproject/onionoo/BandwidthDataWriter.java | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/org/torproject/onionoo/BandwidthDataWriter.java b/src/org/torproject/onionoo/BandwidthDataWriter.java index 7052e3c..4f86371 100644 --- a/src/org/torproject/onionoo/BandwidthDataWriter.java +++ b/src/org/torproject/onionoo/BandwidthDataWriter.java @@ -143,6 +143,12 @@ public class BandwidthDataWriter { String line; while ((line = br.readLine()) != null) { String[] parts = line.split(" "); + if (parts.length != 6) { + System.err.println("Illegal line '" + line + "' in history " + + "file '" + historyFile.getAbsolutePath() + + "'. Skipping this line."); + continue; + } SortedMap<Long, long[]> history = parts[0].equals("r") ? readHistory : writeHistory; long startMillis = this.dateTimeFormat.parse(parts[1] + " "