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

[tor-commits] [onionoo/master] Make some minor clean-ups to the code.



commit 745819787b0c1d259bd3bfa5f19f2bc53951e46a
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Wed Jul 23 16:56:19 2014 +0200

    Make some minor clean-ups to the code.
    
    Suppress warnings, and make more classes publicly visible.
---
 src/org/torproject/onionoo/BandwidthDocument.java    |    5 ++++-
 src/org/torproject/onionoo/BandwidthStatus.java      |    2 +-
 src/org/torproject/onionoo/ClientsDocument.java      |    4 +++-
 src/org/torproject/onionoo/ClientsStatus.java        |    2 +-
 src/org/torproject/onionoo/DetailsDocument.java      |    2 +-
 src/org/torproject/onionoo/DetailsStatus.java        |    2 +-
 src/org/torproject/onionoo/Document.java             |    2 +-
 src/org/torproject/onionoo/RequestHandler.java       |    1 -
 src/org/torproject/onionoo/ResourceServlet.java      |    1 +
 src/org/torproject/onionoo/SummaryDocument.java      |    2 +-
 src/org/torproject/onionoo/UpdateStatus.java         |    2 +-
 src/org/torproject/onionoo/UptimeDocument.java       |    3 ++-
 src/org/torproject/onionoo/UptimeStatus.java         |    2 +-
 src/org/torproject/onionoo/WeightsDocument.java      |   10 +++++++++-
 src/org/torproject/onionoo/WeightsStatus.java        |    2 +-
 test/org/torproject/onionoo/ResourceServletTest.java |    1 +
 16 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/src/org/torproject/onionoo/BandwidthDocument.java b/src/org/torproject/onionoo/BandwidthDocument.java
index e39befb..9c7cd4d 100644
--- a/src/org/torproject/onionoo/BandwidthDocument.java
+++ b/src/org/torproject/onionoo/BandwidthDocument.java
@@ -4,18 +4,21 @@ package org.torproject.onionoo;
 
 import java.util.Map;
 
-class BandwidthDocument extends Document {
+public class BandwidthDocument extends Document {
 
+  @SuppressWarnings("unused")
   private String fingerprint;
   public void setFingerprint(String fingerprint) {
     this.fingerprint = fingerprint;
   }
 
+  @SuppressWarnings("unused")
   private Map<String, GraphHistory> write_history;
   public void setWriteHistory(Map<String, GraphHistory> writeHistory) {
     this.write_history = writeHistory;
   }
 
+  @SuppressWarnings("unused")
   private Map<String, GraphHistory> read_history;
   public void setReadHistory(Map<String, GraphHistory> readHistory) {
     this.read_history = readHistory;
diff --git a/src/org/torproject/onionoo/BandwidthStatus.java b/src/org/torproject/onionoo/BandwidthStatus.java
index 37bbc8d..3252d67 100644
--- a/src/org/torproject/onionoo/BandwidthStatus.java
+++ b/src/org/torproject/onionoo/BandwidthStatus.java
@@ -6,7 +6,7 @@ import java.util.Scanner;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
-class BandwidthStatus extends Document {
+public class BandwidthStatus extends Document {
 
   private SortedMap<Long, long[]> writeHistory =
       new TreeMap<Long, long[]>();
diff --git a/src/org/torproject/onionoo/ClientsDocument.java b/src/org/torproject/onionoo/ClientsDocument.java
index 300541d..e8e40ee 100644
--- a/src/org/torproject/onionoo/ClientsDocument.java
+++ b/src/org/torproject/onionoo/ClientsDocument.java
@@ -4,13 +4,15 @@ package org.torproject.onionoo;
 
 import java.util.Map;
 
-class ClientsDocument extends Document {
+public class ClientsDocument extends Document {
 
+  @SuppressWarnings("unused")
   private String fingerprint;
   public void setFingerprint(String fingerprint) {
     this.fingerprint = fingerprint;
   }
 
+  @SuppressWarnings("unused")
   private Map<String, ClientsGraphHistory> average_clients;
   public void setAverageClients(
       Map<String, ClientsGraphHistory> averageClients) {
diff --git a/src/org/torproject/onionoo/ClientsStatus.java b/src/org/torproject/onionoo/ClientsStatus.java
index 8bf0998..1ea16a7 100644
--- a/src/org/torproject/onionoo/ClientsStatus.java
+++ b/src/org/torproject/onionoo/ClientsStatus.java
@@ -174,7 +174,7 @@ class ClientsHistory implements Comparable<ClientsHistory> {
   }
 }
 
-class ClientsStatus extends Document {
+public class ClientsStatus extends Document {
 
   private SortedSet<ClientsHistory> history =
       new TreeSet<ClientsHistory>();
diff --git a/src/org/torproject/onionoo/DetailsDocument.java b/src/org/torproject/onionoo/DetailsDocument.java
index 8fd11d3..2df6e78 100644
--- a/src/org/torproject/onionoo/DetailsDocument.java
+++ b/src/org/torproject/onionoo/DetailsDocument.java
@@ -7,7 +7,7 @@ import java.util.Map;
 
 import org.apache.commons.lang.StringEscapeUtils;
 
-class DetailsDocument extends Document {
+public class DetailsDocument extends Document {
 
   /* We must ensure that details files only contain ASCII characters
    * and no UTF-8 characters.  While UTF-8 characters are perfectly
diff --git a/src/org/torproject/onionoo/DetailsStatus.java b/src/org/torproject/onionoo/DetailsStatus.java
index 5a552cd..1951c89 100644
--- a/src/org/torproject/onionoo/DetailsStatus.java
+++ b/src/org/torproject/onionoo/DetailsStatus.java
@@ -7,7 +7,7 @@ import java.util.Map;
 
 import org.apache.commons.lang.StringEscapeUtils;
 
-class DetailsStatus extends Document {
+public class DetailsStatus extends Document {
 
   /* We must ensure that details files only contain ASCII characters
    * and no UTF-8 characters.  While UTF-8 characters are perfectly
diff --git a/src/org/torproject/onionoo/Document.java b/src/org/torproject/onionoo/Document.java
index bea0794..f49574c 100644
--- a/src/org/torproject/onionoo/Document.java
+++ b/src/org/torproject/onionoo/Document.java
@@ -2,7 +2,7 @@
  * See LICENSE for licensing information */
 package org.torproject.onionoo;
 
-abstract class Document {
+public abstract class Document {
 
   private transient String documentString;
   public void setDocumentString(String documentString) {
diff --git a/src/org/torproject/onionoo/RequestHandler.java b/src/org/torproject/onionoo/RequestHandler.java
index 39a66e1..58ec17a 100644
--- a/src/org/torproject/onionoo/RequestHandler.java
+++ b/src/org/torproject/onionoo/RequestHandler.java
@@ -10,7 +10,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.SortedMap;
-import java.util.SortedSet;
 
 public class RequestHandler {
 
diff --git a/src/org/torproject/onionoo/ResourceServlet.java b/src/org/torproject/onionoo/ResourceServlet.java
index dad6043..efce86e 100644
--- a/src/org/torproject/onionoo/ResourceServlet.java
+++ b/src/org/torproject/onionoo/ResourceServlet.java
@@ -48,6 +48,7 @@ public class ResourceServlet extends HttpServlet {
     protected String getRequestURI() {
       return this.request.getRequestURI();
     }
+    @SuppressWarnings("rawtypes")
     protected Map getParameterMap() {
       return this.request.getParameterMap();
     }
diff --git a/src/org/torproject/onionoo/SummaryDocument.java b/src/org/torproject/onionoo/SummaryDocument.java
index 3c0f700..61a3ec6 100644
--- a/src/org/torproject/onionoo/SummaryDocument.java
+++ b/src/org/torproject/onionoo/SummaryDocument.java
@@ -14,7 +14,7 @@ import org.apache.commons.codec.DecoderException;
 import org.apache.commons.codec.binary.Hex;
 import org.apache.commons.codec.digest.DigestUtils;
 
-class SummaryDocument extends Document {
+public class SummaryDocument extends Document {
 
   private boolean t;
   public void setRelay(boolean isRelay) {
diff --git a/src/org/torproject/onionoo/UpdateStatus.java b/src/org/torproject/onionoo/UpdateStatus.java
index bd3648d..a697cbf 100644
--- a/src/org/torproject/onionoo/UpdateStatus.java
+++ b/src/org/torproject/onionoo/UpdateStatus.java
@@ -2,6 +2,6 @@
  * See LICENSE for licensing information */
 package org.torproject.onionoo;
 
-class UpdateStatus extends Document {
+public class UpdateStatus extends Document {
 }
 
diff --git a/src/org/torproject/onionoo/UptimeDocument.java b/src/org/torproject/onionoo/UptimeDocument.java
index b2df03b..1946e2c 100644
--- a/src/org/torproject/onionoo/UptimeDocument.java
+++ b/src/org/torproject/onionoo/UptimeDocument.java
@@ -4,8 +4,9 @@ package org.torproject.onionoo;
 
 import java.util.Map;
 
-class UptimeDocument extends Document {
+public class UptimeDocument extends Document {
 
+  @SuppressWarnings("unused")
   private String fingerprint;
   public void setFingerprint(String fingerprint) {
     this.fingerprint = fingerprint;
diff --git a/src/org/torproject/onionoo/UptimeStatus.java b/src/org/torproject/onionoo/UptimeStatus.java
index 4cf71c6..92ca629 100644
--- a/src/org/torproject/onionoo/UptimeStatus.java
+++ b/src/org/torproject/onionoo/UptimeStatus.java
@@ -93,7 +93,7 @@ class UptimeHistory
   }
 }
 
-class UptimeStatus extends Document {
+public class UptimeStatus extends Document {
 
   private transient String fingerprint;
 
diff --git a/src/org/torproject/onionoo/WeightsDocument.java b/src/org/torproject/onionoo/WeightsDocument.java
index 6dddf9d..4cd0021 100644
--- a/src/org/torproject/onionoo/WeightsDocument.java
+++ b/src/org/torproject/onionoo/WeightsDocument.java
@@ -4,49 +4,57 @@ package org.torproject.onionoo;
 
 import java.util.Map;
 
-class WeightsDocument extends Document {
+public class WeightsDocument extends Document {
 
+  @SuppressWarnings("unused")
   private String fingerprint;
   public void setFingerprint(String fingerprint) {
     this.fingerprint = fingerprint;
   }
 
+  @SuppressWarnings("unused")
   private Map<String, GraphHistory> advertised_bandwidth_fraction;
   public void setAdvertisedBandwidthFraction(
       Map<String, GraphHistory> advertisedBandwidthFraction) {
     this.advertised_bandwidth_fraction = advertisedBandwidthFraction;
   }
 
+  @SuppressWarnings("unused")
   private Map<String, GraphHistory> consensus_weight_fraction;
   public void setConsensusWeightFraction(
       Map<String, GraphHistory> consensusWeightFraction) {
     this.consensus_weight_fraction = consensusWeightFraction;
   }
 
+  @SuppressWarnings("unused")
   private Map<String, GraphHistory> guard_probability;
   public void setGuardProbability(
       Map<String, GraphHistory> guardProbability) {
     this.guard_probability = guardProbability;
   }
 
+  @SuppressWarnings("unused")
   private Map<String, GraphHistory> middle_probability;
   public void setMiddleProbability(
       Map<String, GraphHistory> middleProbability) {
     this.middle_probability = middleProbability;
   }
 
+  @SuppressWarnings("unused")
   private Map<String, GraphHistory> exit_probability;
   public void setExitProbability(
       Map<String, GraphHistory> exitProbability) {
     this.exit_probability = exitProbability;
   }
 
+  @SuppressWarnings("unused")
   private Map<String, GraphHistory> advertised_bandwidth;
   public void setAdvertisedBandwidth(
       Map<String, GraphHistory> advertisedBandwidth) {
     this.advertised_bandwidth = advertisedBandwidth;
   }
 
+  @SuppressWarnings("unused")
   private Map<String, GraphHistory> consensus_weight;
   public void setConsensusWeight(
       Map<String, GraphHistory> consensusWeight) {
diff --git a/src/org/torproject/onionoo/WeightsStatus.java b/src/org/torproject/onionoo/WeightsStatus.java
index f5eacd9..6d06ca4 100644
--- a/src/org/torproject/onionoo/WeightsStatus.java
+++ b/src/org/torproject/onionoo/WeightsStatus.java
@@ -7,7 +7,7 @@ import java.util.Scanner;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
-class WeightsStatus extends Document {
+public class WeightsStatus extends Document {
 
   private SortedMap<long[], double[]> history =
       new TreeMap<long[], double[]>(new Comparator<long[]>() {
diff --git a/test/org/torproject/onionoo/ResourceServletTest.java b/test/org/torproject/onionoo/ResourceServletTest.java
index e482f82..f2ace5d 100644
--- a/test/org/torproject/onionoo/ResourceServletTest.java
+++ b/test/org/torproject/onionoo/ResourceServletTest.java
@@ -51,6 +51,7 @@ public class ResourceServletTest {
     protected String getRequestURI() {
       return this.requestURI;
     }
+    @SuppressWarnings("rawtypes")
     protected Map getParameterMap() {
       return this.parameterMap;
     }



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