Fix newly detected violations from PMD 7
This commit is contained in:
parent
2f7ce42480
commit
dd896347a2
28 changed files with 65 additions and 57 deletions
|
|
@ -31,7 +31,7 @@ public class IpAccessMonitor {
|
|||
}
|
||||
|
||||
private static void cleanup(long t) {
|
||||
HashMap<String, Long> newMap = new HashMap<>(ipAccess.size());
|
||||
Map<String, Long> newMap = new HashMap<>(ipAccess.size());
|
||||
for (Map.Entry<String, Long> e : ipAccess.entrySet()) {
|
||||
if (t - e.getValue().longValue() <= MAX_IDLE) {
|
||||
newMap.put(e.getKey(), e.getValue());
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package btools.server;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class Polygon {
|
||||
|
|
@ -15,7 +16,7 @@ public class Polygon {
|
|||
private int maxy = Integer.MIN_VALUE;
|
||||
|
||||
public Polygon(BufferedReader br) throws IOException {
|
||||
ArrayList<String> lines = new ArrayList<>();
|
||||
List<String> lines = new ArrayList<>();
|
||||
|
||||
for (; ; ) {
|
||||
String line = br.readLine();
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Queue;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
|
|
@ -299,7 +300,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
|
|||
|
||||
ProfileCache.setSize(2 * maxthreads);
|
||||
|
||||
PriorityQueue<RouteServer> threadQueue = new PriorityQueue<>();
|
||||
Queue<RouteServer> threadQueue = new PriorityQueue<>();
|
||||
|
||||
ServerSocket serverSocket = args.length > 5 ? new ServerSocket(Integer.parseInt(args[3]), 100, InetAddress.getByName(args[5])) : new ServerSocket(Integer.parseInt(args[3]));
|
||||
|
||||
|
|
@ -364,7 +365,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
|
|||
|
||||
|
||||
private static Map<String, String> getUrlParams(String url) throws UnsupportedEncodingException {
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
Map<String, String> params = new HashMap<>();
|
||||
String decoded = URLDecoder.decode(url, "UTF-8");
|
||||
StringTokenizer tk = new StringTokenizer(decoded, "?&");
|
||||
while (tk.hasMoreTokens()) {
|
||||
|
|
@ -417,7 +418,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
|
|||
bw.write("\n");
|
||||
}
|
||||
|
||||
private static void cleanupThreadQueue(PriorityQueue<RouteServer> threadQueue) {
|
||||
private static void cleanupThreadQueue(Queue<RouteServer> threadQueue) {
|
||||
for (; ; ) {
|
||||
boolean removedItem = false;
|
||||
for (RouteServer t : threadQueue) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.TreeSet;
|
||||
|
||||
|
|
@ -244,7 +245,7 @@ public class SuspectManager extends Thread {
|
|||
bw.write("<table>\n");
|
||||
File countryParent = new File("worldpolys" + country);
|
||||
File[] files = countryParent.listFiles();
|
||||
TreeSet<String> names = new TreeSet<>();
|
||||
Set<String> names = new TreeSet<>();
|
||||
for (File f : files) {
|
||||
String name = f.getName();
|
||||
if (name.endsWith(".poly")) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class ProfileUploadHandler {
|
|||
String id;
|
||||
if (profileId != null) {
|
||||
// update existing file when id appended
|
||||
id = profileId.substring(ProfileUploadHandler.CUSTOM_PREFIX.length());
|
||||
id = profileId.substring(CUSTOM_PREFIX.length());
|
||||
} else {
|
||||
id = "" + System.currentTimeMillis();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import org.junit.Ignore;
|
|||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import btools.router.RoutingContext;
|
||||
import btools.server.request.ServerHandler;
|
||||
|
|
@ -13,7 +14,7 @@ public class RequestHandlerTest {
|
|||
@Test
|
||||
@Ignore("Parameters are currently handled by RouteServer, not RequestHandler")
|
||||
public void parseParameters() {
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("lonlats", "8.799297,49.565883|8.811764,49.563606");
|
||||
params.put("profile", "trekking");
|
||||
params.put("alternativeidx", "0");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue