mirror of
https://github.com/torproject/collector.git
synced 2024-11-23 09:29:46 +00:00
Inline redundant local variables.
This commit is contained in:
parent
5080bf9907
commit
7c44c114e4
@ -44,10 +44,9 @@ public class BridgeSnapshotReader {
|
||||
}
|
||||
|
||||
SortedSet<String> parsed = new TreeSet<>();
|
||||
File bdDir = bridgeDirectoriesDir;
|
||||
File pbdFile = new File(statsDirectory, "parsed-bridge-directories");
|
||||
boolean modified = false;
|
||||
if (bdDir.exists()) {
|
||||
if (bridgeDirectoriesDir.exists()) {
|
||||
if (pbdFile.exists()) {
|
||||
logger.debug("Reading file {}...", pbdFile.getAbsolutePath());
|
||||
try {
|
||||
@ -73,7 +72,7 @@ public class BridgeSnapshotReader {
|
||||
int parsedExtraInfoDescriptors = 0;
|
||||
int skippedExtraInfoDescriptors = 0;
|
||||
Stack<File> filesInInputDir = new Stack<>();
|
||||
filesInInputDir.add(bdDir);
|
||||
filesInInputDir.add(bridgeDirectoriesDir);
|
||||
while (!filesInInputDir.isEmpty()) {
|
||||
File pop = filesInInputDir.pop();
|
||||
if (pop.isDirectory()) {
|
||||
|
@ -274,11 +274,10 @@ public class SanitizedBridgesWriter extends CollecTorMain {
|
||||
byte[] secret = this.getSecretForMonth(month);
|
||||
System.arraycopy(secret, 0, hashInput, 24, 31);
|
||||
byte[] hashOutput = DigestUtils.sha256(hashInput);
|
||||
String hashedAddress = "10."
|
||||
return "10."
|
||||
+ (((int) hashOutput[0] + 256) % 256) + "."
|
||||
+ (((int) hashOutput[1] + 256) % 256) + "."
|
||||
+ (((int) hashOutput[2] + 256) % 256);
|
||||
return hashedAddress;
|
||||
} else {
|
||||
return "127.0.0.1";
|
||||
}
|
||||
@ -1090,9 +1089,7 @@ public class SanitizedBridgesWriter extends CollecTorMain {
|
||||
masterKeyEd25519, 0, masterKeyEd25519.length);
|
||||
String masterKeyEd25519Base64 = Base64.encodeBase64String(
|
||||
masterKeyEd25519);
|
||||
String masterKeyEd25519Base64NoTrailingEqualSigns =
|
||||
masterKeyEd25519Base64.replaceAll("=", "");
|
||||
return masterKeyEd25519Base64NoTrailingEqualSigns;
|
||||
return masterKeyEd25519Base64.replaceAll("=", "");
|
||||
}
|
||||
extensionStart += 4 + extensionLength;
|
||||
}
|
||||
|
@ -146,16 +146,14 @@ public class CreateIndexJson extends CollecTorMain {
|
||||
}
|
||||
}
|
||||
}
|
||||
DirectoryNode directoryNode = new DirectoryNode(
|
||||
return new DirectoryNode(
|
||||
directory.getName(), fileNodes.isEmpty() ? null : fileNodes,
|
||||
directoryNodes.isEmpty() ? null : directoryNodes);
|
||||
return directoryNode;
|
||||
}
|
||||
|
||||
private FileNode indexFile(File file) {
|
||||
FileNode fileNode = new FileNode(file.getName(), file.length(),
|
||||
return new FileNode(file.getName(), file.length(),
|
||||
dateTimeFormat.format(file.lastModified()));
|
||||
return fileNode;
|
||||
}
|
||||
|
||||
private void writeIndex(IndexNode indexNode) throws Exception {
|
||||
|
Loading…
Reference in New Issue
Block a user