Commit d9cafd8e authored by Karsten Loesing's avatar Karsten Loesing
Browse files

Remove redundant initializers.

parent c8c64e88
......@@ -90,7 +90,7 @@ public class ClientsHistory implements Comparable<ClientsHistory> {
+ "'. Skipping.");
return null;
}
double totalResponses = 0.0;
double totalResponses;
try {
totalResponses = Double.parseDouble(parts[4]);
} catch (NumberFormatException e) {
......@@ -125,7 +125,7 @@ public class ClientsHistory implements Comparable<ClientsHistory> {
/* Logged by caller */
return null;
}
double value = 0.0;
double value;
try {
value = Double.parseDouble(keyValue[1]);
} catch (NumberFormatException e) {
......
......@@ -469,7 +469,7 @@ public class DocumentStore {
+ "directory.");
return null;
}
String documentString = null;
String documentString;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
BufferedInputStream bis = new BufferedInputStream(
new FileInputStream(documentFile))) {
......@@ -782,7 +782,7 @@ public class DocumentStore {
StringBuilder sb = new StringBuilder();
for (SummaryDocument summaryDocument :
this.cachedSummaryDocuments.values()) {
String line = null;
String line;
try {
line = objectMapper.writeValueAsString(summaryDocument);
} catch (JsonProcessingException e) {
......
......@@ -564,7 +564,7 @@ public class NodeStatus extends Document {
SortedSet<String> orAddressesAndPorts = new TreeSet<>();
SortedSet<String> exitAddresses = new TreeSet<>();
String addresses = parts[3];
String address = null;
String address;
if (addresses.contains(";")) {
String[] addressParts = addresses.split(";", -1);
if (addressParts.length != 3) {
......
......@@ -78,7 +78,7 @@ public class UptimeHistory implements Comparable<UptimeHistory> {
+ uptimeHistoryString + "'. Skipping.");
return null;
}
int uptimeHours = -1;
int uptimeHours;
try {
uptimeHours = Integer.parseInt(parts[2]);
} catch (NumberFormatException e) {
......
......@@ -10,7 +10,7 @@ import javax.servlet.http.HttpServletResponse;
public class HttpServletResponseWrapper {
private HttpServletResponse response = null;
private HttpServletResponse response;
protected HttpServletResponseWrapper(HttpServletResponse response) {
this.response = response;
......
......@@ -109,7 +109,7 @@ public class ResourceServlet extends HttpServlet {
if (uri.startsWith("/onionoo/")) {
uri = uri.substring("/onionoo".length());
}
String resourceType = null;
String resourceType;
if (uri.startsWith("/summary")) {
resourceType = "summary";
} else if (uri.startsWith("/details")) {
......@@ -388,7 +388,7 @@ public class ResourceServlet extends HttpServlet {
rb.setBridgesSkipped(rh.getBridgesSkipped());
rb.setRelaysTruncated(rh.getRelaysTruncated());
rb.setBridgesTruncated(rh.getBridgesTruncated());
String[] fields = null;
String[] fields;
if (parameterMap.containsKey("fields")) {
fields = this.parseFieldsParameter(parameterMap.get("fields"));
if (fields == null) {
......
......@@ -458,7 +458,7 @@ public class NodeDetailsStatusUpdater implements DescriptorListener,
for (String fingerprint : previouslyKnownNodes) {
NodeStatus nodeStatus = this.documentStore.retrieve(
NodeStatus.class, true, fingerprint);
NodeStatus updatedNodeStatus = null;
NodeStatus updatedNodeStatus;
if (this.knownNodes.containsKey(fingerprint)) {
updatedNodeStatus = this.knownNodes.get(fingerprint);
String address = nodeStatus.getAddress();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment