commit 64141ebf1bd5445a0f746cb598c867ace067c9df Author: Karsten Loesing karsten.loesing@gmx.net Date: Tue Dec 11 13:11:05 2012 +0100
Don't generate invalid JSON documents.
Fixes #7701, found by hellais. --- src/org/torproject/onionoo/DetailDataWriter.java | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/org/torproject/onionoo/DetailDataWriter.java b/src/org/torproject/onionoo/DetailDataWriter.java index 7d0ab15..d681958 100644 --- a/src/org/torproject/onionoo/DetailDataWriter.java +++ b/src/org/torproject/onionoo/DetailDataWriter.java @@ -607,10 +607,10 @@ public class DetailDataWriter { } sb.append(",\n"last_seen":"" + lastSeen + """); sb.append(",\n"first_seen":"" + firstSeen + """); - sb.append(",\n"running":" + running + ",\n"); + sb.append(",\n"running":" + running); SortedSet<String> relayFlags = entry.getRelayFlags(); if (!relayFlags.isEmpty()) { - sb.append(""flags":["); + sb.append(",\n"flags":["); int written = 0; for (String relayFlag : relayFlags) { sb.append((written++ > 0 ? "," : "") + """ + relayFlag + """); @@ -847,11 +847,11 @@ public class DetailDataWriter { + ""hashed_fingerprint":"" + fingerprint + "",\n" + ""or_addresses":[" + orAddressesAndPortsBuilder.toString() + "],\n"last_seen":"" + lastSeen + "",\n"first_seen":"" - + firstSeen + "",\n"running":" + running + ","); + + firstSeen + "",\n"running":" + running);
SortedSet<String> relayFlags = entry.getRelayFlags(); if (!relayFlags.isEmpty()) { - sb.append("\n"flags":["); + sb.append(",\n"flags":["); int written = 0; for (String relayFlag : relayFlags) { sb.append((written++ > 0 ? "," : "") + """ + relayFlag + """);
tor-commits@lists.torproject.org