[tor-commits] [metrics-web/release] Remove redundant initializers.

karsten at torproject.org karsten at torproject.org
Wed Sep 26 15:20:35 UTC 2018


commit 9e505746e5cc6495a0d9687d300d09cdee1e2bda
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Mon Aug 20 16:30:04 2018 +0200

    Remove redundant initializers.
---
 .../metrics/stats/hidserv/ExtrapolatedHidServStats.java           | 8 ++++----
 .../torproject/metrics/stats/hidserv/ReportedHidServStats.java    | 6 +++---
 .../metrics/stats/servers/ConsensusStatsFileHandler.java          | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/torproject/metrics/stats/hidserv/ExtrapolatedHidServStats.java b/src/main/java/org/torproject/metrics/stats/hidserv/ExtrapolatedHidServStats.java
index d4a741d..9379d87 100644
--- a/src/main/java/org/torproject/metrics/stats/hidserv/ExtrapolatedHidServStats.java
+++ b/src/main/java/org/torproject/metrics/stats/hidserv/ExtrapolatedHidServStats.java
@@ -142,10 +142,10 @@ public class ExtrapolatedHidServStats implements Document {
       return false;
     }
     String fingerprint = secondParts[0];
-    double extrapolatedRendRelayedCells = 0.0;
-    double fractionRendRelayedCells = 0.0;
-    double extrapolatedDirOnionsSeen = 0.0;
-    double fractionDirOnionsSeen = 0.0;
+    double extrapolatedRendRelayedCells;
+    double fractionRendRelayedCells;
+    double extrapolatedDirOnionsSeen;
+    double fractionDirOnionsSeen;
     try {
       extrapolatedRendRelayedCells = secondParts[1].equals("") ? 0.0
           : Double.parseDouble(secondParts[1]);
diff --git a/src/main/java/org/torproject/metrics/stats/hidserv/ReportedHidServStats.java b/src/main/java/org/torproject/metrics/stats/hidserv/ReportedHidServStats.java
index 0ff5fd4..08ab024 100644
--- a/src/main/java/org/torproject/metrics/stats/hidserv/ReportedHidServStats.java
+++ b/src/main/java/org/torproject/metrics/stats/hidserv/ReportedHidServStats.java
@@ -120,9 +120,9 @@ public class ReportedHidServStats implements Document {
     if (statsEndMillis == DateTimeHelper.NO_TIME_AVAILABLE) {
       return false;
     }
-    long statsIntervalSeconds = -1L;
-    long rendRelayedCells = -1L;
-    long dirOnionsSeen = -1L;
+    long statsIntervalSeconds;
+    long rendRelayedCells;
+    long dirOnionsSeen;
     try {
       statsIntervalSeconds = Long.parseLong(secondParts[1]);
       rendRelayedCells = Long.parseLong(secondParts[2]);
diff --git a/src/main/java/org/torproject/metrics/stats/servers/ConsensusStatsFileHandler.java b/src/main/java/org/torproject/metrics/stats/servers/ConsensusStatsFileHandler.java
index c1c1e8b..ebbce60 100644
--- a/src/main/java/org/torproject/metrics/stats/servers/ConsensusStatsFileHandler.java
+++ b/src/main/java/org/torproject/metrics/stats/servers/ConsensusStatsFileHandler.java
@@ -71,7 +71,7 @@ public class ConsensusStatsFileHandler {
   private int bridgeResultsAdded = 0;
 
   /* Database connection string. */
-  private String connectionUrl = null;
+  private String connectionUrl;
 
   private SimpleDateFormat dateTimeFormat;
 





More information about the tor-commits mailing list