[tor-commits] [onionoo/master] Omit "flags" field if a relay or bridge has no flags.
karsten at torproject.org
karsten at torproject.org
Sun Jul 7 17:07:42 UTC 2013
commit 885f040cc42ca7592e60e1009e2e953f18d6f4da
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Sun Jul 7 17:28:22 2013 +0200
Omit "flags" field if a relay or bridge has no flags.
So far, we parsed the empty string as single flag called "". This is a
bug. We need to omit the "flags" field in this case.
---
src/org/torproject/onionoo/NodeStatus.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/org/torproject/onionoo/NodeStatus.java b/src/org/torproject/onionoo/NodeStatus.java
index 81e5c7f..4f207a0 100644
--- a/src/org/torproject/onionoo/NodeStatus.java
+++ b/src/org/torproject/onionoo/NodeStatus.java
@@ -158,8 +158,10 @@ public class NodeStatus extends Document {
getTime();
orPort = Integer.parseInt(parts[6]);
dirPort = Integer.parseInt(parts[7]);
- relayFlags = new TreeSet<String>(
- Arrays.asList(parts[8].split(",")));
+ relayFlags = new TreeSet<String>();
+ if (parts[8].length() > 0) {
+ relayFlags.addAll(Arrays.asList(parts[8].split(",")));
+ }
if (parts.length > 9) {
consensusWeight = Long.parseLong(parts[9]);
}
More information about the tor-commits
mailing list