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

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



commit c54a3f7f3f603a7f11b46b606405e8c411c8f299
Author: iwakeh <iwakeh@xxxxxxxxxxxxxx>
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

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