[tor-commits] [onionoo/master] Part of task-19259 implementation.

karsten at torproject.org karsten at torproject.org
Thu Nov 17 13:17:17 UTC 2016


commit c54a3f7f3f603a7f11b46b606405e8c411c8f299
Author: iwakeh <iwakeh at torproject.org>
Date:   Wed Nov 16 15:03:48 2016 +0100

    Part of task-19259 implementation.
    Make test for old-style weight status docs pass.
---
 src/main/java/org/torproject/onionoo/docs/WeightsStatus.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/torproject/onionoo/docs/WeightsStatus.java b/src/main/java/org/torproject/onionoo/docs/WeightsStatus.java
index ce8d915..50b8b35 100644
--- a/src/main/java/org/torproject/onionoo/docs/WeightsStatus.java
+++ b/src/main/java/org/torproject/onionoo/docs/WeightsStatus.java
@@ -106,7 +106,8 @@ public class WeightsStatus extends Document {
   }
 
   private double parseWeightDouble(String in) throws NumberFormatException {
-    return in.isEmpty() ? Double.NaN : Double.parseDouble(in);
+    return in.isEmpty() || in.startsWith("-")
+        ? Double.NaN : Double.parseDouble(in);
   }
 
   /** Adds all given weights history objects that don't overlap with



More information about the tor-commits mailing list