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

[tor-commits] [metrics-lib/release] Replace if with switch.



commit 0cb2f05ba4ee2d6cb4699739163200997232c8c9
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Tue Aug 21 12:22:41 2018 +0200

    Replace if with switch.
---
 .../torproject/descriptor/impl/TorperfResultImpl.java   | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/torproject/descriptor/impl/TorperfResultImpl.java b/src/main/java/org/torproject/descriptor/impl/TorperfResultImpl.java
index 47de53f..4eb00ac 100644
--- a/src/main/java/org/torproject/descriptor/impl/TorperfResultImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/TorperfResultImpl.java
@@ -286,13 +286,16 @@ public class TorperfResultImpl extends DescriptorImpl
 
   private void parseDidTimeout(String value, String keyValue, String line)
       throws DescriptorParseException {
-    if (value.equals("1")) {
-      this.didTimeout = true;
-    } else if (value.equals("0")) {
-      this.didTimeout = false;
-    } else {
-      throw new DescriptorParseException("Illegal value in '" + keyValue
-          + "' in line '" + line + "'.");
+    switch (value) {
+      case "1":
+        this.didTimeout = true;
+        break;
+      case "0":
+        this.didTimeout = false;
+        break;
+      default:
+        throw new DescriptorParseException("Illegal value in '" + keyValue
+            + "' in line '" + line + "'.");
     }
   }
 



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