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

[tor-commits] [metrics-web/master] Use parameterized map for parameters.



commit a695f2ff928ea8593fe268d4c883e07920c67865
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Mon Aug 20 16:01:54 2018 +0200

    Use parameterized map for parameters.
---
 src/main/java/org/torproject/metrics/web/RObjectGenerator.java      | 6 +++---
 src/main/java/org/torproject/metrics/web/TableParameterChecker.java | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/torproject/metrics/web/RObjectGenerator.java b/src/main/java/org/torproject/metrics/web/RObjectGenerator.java
index 9943f17..196e834 100644
--- a/src/main/java/org/torproject/metrics/web/RObjectGenerator.java
+++ b/src/main/java/org/torproject/metrics/web/RObjectGenerator.java
@@ -92,7 +92,7 @@ public class RObjectGenerator implements ServletContextListener {
           generateTable(tableId, new HashMap(), false);
         }
         for (String graphId : availableGraphs.keySet()) {
-          generateGraph(graphId, "png", new HashMap(), false);
+          generateGraph(graphId, "png", new HashMap<>(), false);
         }
         lastUpdated = System.currentTimeMillis();
       }
@@ -108,7 +108,7 @@ public class RObjectGenerator implements ServletContextListener {
    * the given parameters, possibly after checking whether the cache
    * already contains that graph. */
   public RObject generateGraph(String requestedGraph, String fileType,
-      Map parameterMap, boolean checkCache) {
+      Map<String, String[]> parameterMap, boolean checkCache) {
     if (!this.availableGraphs.containsKey(requestedGraph)
         || this.availableGraphs.get(requestedGraph).getFunction()
         == null) {
@@ -168,7 +168,7 @@ public class RObjectGenerator implements ServletContextListener {
    * possibly after checking whether the cache already contains that
    * table. */
   public List<Map<String, String>> generateTable(String requestedTable,
-      Map parameterMap, boolean checkCache) {
+      Map<String, String[]> parameterMap, boolean checkCache) {
     if (!this.availableTables.containsKey(requestedTable)
         || this.availableTables.get(requestedTable).getFunction()
         == null) {
diff --git a/src/main/java/org/torproject/metrics/web/TableParameterChecker.java b/src/main/java/org/torproject/metrics/web/TableParameterChecker.java
index 02e9acb..a919097 100644
--- a/src/main/java/org/torproject/metrics/web/TableParameterChecker.java
+++ b/src/main/java/org/torproject/metrics/web/TableParameterChecker.java
@@ -57,7 +57,7 @@ public class TableParameterChecker {
    * the parameters are invalid.
    */
   public Map<String, String[]> checkParameters(String tableType,
-      Map requestParameters) {
+      Map<String, String[]> requestParameters) {
 
     /* Check if the table type exists. */
     if (tableType == null
@@ -80,8 +80,8 @@ public class TableParameterChecker {
       String[] startParameter = null;
       String[] endParameter = null;
       if (requestParameters != null) {
-        startParameter = (String[]) requestParameters.get("start");
-        endParameter = (String[]) requestParameters.get("end");
+        startParameter = requestParameters.get("start");
+        endParameter = requestParameters.get("end");
       }
       long endTimestamp = System.currentTimeMillis();
       if (endParameter != null && endParameter.length > 0



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