Enable PMD rule LooseCoupling and fix violations

This commit is contained in:
Manuel Fuhr 2022-11-13 12:38:30 +01:00
parent c75a8cb703
commit 30be64cbbe
26 changed files with 64 additions and 50 deletions

View file

@ -5,7 +5,7 @@ import java.util.Map;
public class IpAccessMonitor {
private static Object sync = new Object();
private static HashMap<String, Long> ipAccess = new HashMap<String, Long>();
private static Map<String, Long> ipAccess = new HashMap<String, Long>();
private static long MAX_IDLE = 900000; // 15 minutes
private static long CLEANUP_INTERVAL = 10000; // 10 seconds
private static long lastCleanup;

View file

@ -146,7 +146,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
}
String url = getline.split(" ")[1];
HashMap<String, String> params = getUrlParams(url);
Map<String, String> params = getUrlParams(url);
long maxRunningTime = getMaxRunningTime();
@ -359,7 +359,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
}
private static HashMap<String, String> getUrlParams(String url) throws UnsupportedEncodingException {
private static Map<String, String> getUrlParams(String url) throws UnsupportedEncodingException {
HashMap<String, String> params = new HashMap<String, String>();
String decoded = URLDecoder.decode(url, "UTF-8");
StringTokenizer tk = new StringTokenizer(decoded, "?&");

View file

@ -8,6 +8,7 @@ import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeSet;
@ -581,7 +582,7 @@ public class SuspectManager extends Thread {
}
}
private static HashMap<String, SuspectList> allSuspectsMap = new HashMap<String, SuspectList>();
private static Map<String, SuspectList> allSuspectsMap = new HashMap<String, SuspectList>();
private static SuspectList getDailySuspectsIfLoaded() throws IOException {
synchronized (allSuspectsMap) {

View file

@ -4,8 +4,8 @@ import java.io.BufferedWriter;
import java.io.File;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import btools.router.OsmNodeNamed;
import btools.router.OsmNogoPolygon;
@ -36,7 +36,7 @@ public class ServerHandler extends RequestHandler {
private RoutingContext rc;
public ServerHandler(ServiceContext serviceContext, HashMap<String, String> params) {
public ServerHandler(ServiceContext serviceContext, Map<String, String> params) {
super(serviceContext, params);
}