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

[tor-commits] [metrics-web/master] Remove unnecessary return statements.



commit 79994eb3e1a4e89f6904a33a1591b375ab8f104e
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Tue Aug 21 11:47:07 2018 +0200

    Remove unnecessary return statements.
---
 .../java/org/torproject/metrics/stats/hidserv/Parser.java | 15 ++++-----------
 .../java/org/torproject/metrics/web/RObjectGenerator.java |  2 +-
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/torproject/metrics/stats/hidserv/Parser.java b/src/main/java/org/torproject/metrics/stats/hidserv/Parser.java
index 4f7ac6c..5970e32 100644
--- a/src/main/java/org/torproject/metrics/stats/hidserv/Parser.java
+++ b/src/main/java/org/torproject/metrics/stats/hidserv/Parser.java
@@ -199,19 +199,10 @@ public class Parser {
     /* Extract the fingerprint from the parsed descriptor. */
     String fingerprint = extraInfoDescriptor.getFingerprint();
 
-    /* If the descriptor did not contain any of the expected hidserv-*
-     * lines, don't do anything.  This applies to the majority of
-     * descriptors, at least as long as only a minority of relays reports
-     * these statistics. */
-    if (extraInfoDescriptor.getHidservStatsEndMillis() < 0L
-        && extraInfoDescriptor.getHidservRendRelayedCells() == null
-        && extraInfoDescriptor.getHidservDirOnionsSeen() == null) {
-      return;
-
     /* If the descriptor contained all expected hidserv-* lines, create a
      * new stats object and put it in the local map, so that it will later
      * be written to a document file. */
-    } else if (extraInfoDescriptor.getHidservStatsEndMillis() >= 0L
+    if (extraInfoDescriptor.getHidservStatsEndMillis() >= 0L
         && extraInfoDescriptor.getHidservStatsIntervalLength() >= 0L
         && extraInfoDescriptor.getHidservRendRelayedCells() != null
         && extraInfoDescriptor.getHidservRendRelayedCellsParameters() != null
@@ -237,7 +228,9 @@ public class Parser {
      * out a warning.  This case does not warrant any further action,
      * because relays can in theory write anything in their extra-info
      * descriptors.  But maybe we'll want to know. */
-    } else {
+    } else if (extraInfoDescriptor.getHidservStatsEndMillis() >= 0L
+        || extraInfoDescriptor.getHidservRendRelayedCells() != null
+        || extraInfoDescriptor.getHidservDirOnionsSeen() != null) {
       log.warn("Relay {} published incomplete hidserv-stats. Ignoring.",
           fingerprint);
     }
diff --git a/src/main/java/org/torproject/metrics/web/RObjectGenerator.java b/src/main/java/org/torproject/metrics/web/RObjectGenerator.java
index 8490eef..a529830 100644
--- a/src/main/java/org/torproject/metrics/web/RObjectGenerator.java
+++ b/src/main/java/org/torproject/metrics/web/RObjectGenerator.java
@@ -345,7 +345,7 @@ public class RObjectGenerator implements ServletContextListener {
         this.result = new RObject(baos.toByteArray(), this.fileName,
             lastModified);
       } catch (IOException e) {
-        return;
+        /* Nothing to do here. */
       }
     }
 



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