commit 8b89bd0676e989b0073fdb6ec392c5342adf1eb5 Author: Karsten Loesing karsten.loesing@gmx.net Date: Mon Aug 20 12:03:05 2018 +0200
Remove unused parameters. --- .../descriptor/impl/BandwidthHistoryImpl.java | 2 +- .../impl/DirectoryKeyCertificateImpl.java | 22 +-- .../descriptor/impl/ExtraInfoDescriptorImpl.java | 210 ++++++++++----------- .../descriptor/impl/NetworkStatusEntryImpl.java | 8 +- .../descriptor/impl/RelayDirectoryImpl.java | 36 ++-- .../descriptor/impl/RelayNetworkStatusImpl.java | 16 +- .../impl/RelayNetworkStatusVoteImpl.java | 36 ++-- .../descriptor/impl/ServerDescriptorImpl.java | 157 ++++++++------- .../descriptor/impl/TorperfResultImpl.java | 28 +-- 9 files changed, 254 insertions(+), 261 deletions(-)
diff --git a/src/main/java/org/torproject/descriptor/impl/BandwidthHistoryImpl.java b/src/main/java/org/torproject/descriptor/impl/BandwidthHistoryImpl.java index 79c185d..ec6de2d 100644 --- a/src/main/java/org/torproject/descriptor/impl/BandwidthHistoryImpl.java +++ b/src/main/java/org/torproject/descriptor/impl/BandwidthHistoryImpl.java @@ -11,7 +11,7 @@ import java.util.TreeMap;
public class BandwidthHistoryImpl implements BandwidthHistory {
- protected BandwidthHistoryImpl(String line, String lineNoOpt, + protected BandwidthHistoryImpl(String line, String[] partsNoOpt) throws DescriptorParseException { boolean isValid = false; this.line = line; diff --git a/src/main/java/org/torproject/descriptor/impl/DirectoryKeyCertificateImpl.java b/src/main/java/org/torproject/descriptor/impl/DirectoryKeyCertificateImpl.java index cdc9d44..a9268ce 100644 --- a/src/main/java/org/torproject/descriptor/impl/DirectoryKeyCertificateImpl.java +++ b/src/main/java/org/torproject/descriptor/impl/DirectoryKeyCertificateImpl.java @@ -45,7 +45,7 @@ public class DirectoryKeyCertificateImpl extends DescriptorImpl Key key = Key.get(parts[0]); switch (key) { case DIR_KEY_CERTIFICATE_VERSION: - this.parseDirKeyCertificateVersionLine(line, parts); + this.parseDirKeyCertificateVersionLine(line); break; case DIR_ADDRESS: this.parseDirAddressLine(line, parts); @@ -54,7 +54,7 @@ public class DirectoryKeyCertificateImpl extends DescriptorImpl this.parseFingerprintLine(line, parts); break; case DIR_IDENTITY_KEY: - this.parseDirIdentityKeyLine(line, parts); + this.parseDirIdentityKeyLine(line); nextCrypto = key; break; case DIR_KEY_PUBLISHED: @@ -64,15 +64,15 @@ public class DirectoryKeyCertificateImpl extends DescriptorImpl this.parseDirKeyExpiresLine(line, parts); break; case DIR_SIGNING_KEY: - this.parseDirSigningKeyLine(line, parts); + this.parseDirSigningKeyLine(line); nextCrypto = key; break; case DIR_KEY_CROSSCERT: - this.parseDirKeyCrosscertLine(line, parts); + this.parseDirKeyCrosscertLine(line); nextCrypto = key; break; case DIR_KEY_CERTIFICATION: - this.parseDirKeyCertificationLine(line, parts); + this.parseDirKeyCertificationLine(line); nextCrypto = key; break; case CRYPTO_BEGIN: @@ -115,8 +115,8 @@ public class DirectoryKeyCertificateImpl extends DescriptorImpl } }
- private void parseDirKeyCertificateVersionLine(String line, - String[] parts) throws DescriptorParseException { + private void parseDirKeyCertificateVersionLine(String line) + throws DescriptorParseException { if (!line.equals(Key.DIR_KEY_CERTIFICATE_VERSION.keyword + SP + "3")) { throw new DescriptorParseException("Illegal directory key " + "certificate version number in line '" + line + "'."); @@ -145,7 +145,7 @@ public class DirectoryKeyCertificateImpl extends DescriptorImpl parts[1]); }
- private void parseDirIdentityKeyLine(String line, String[] parts) + private void parseDirIdentityKeyLine(String line) throws DescriptorParseException { if (!line.equals(Key.DIR_IDENTITY_KEY.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -164,21 +164,21 @@ public class DirectoryKeyCertificateImpl extends DescriptorImpl parts, 1, 2); }
- private void parseDirSigningKeyLine(String line, String[] parts) + private void parseDirSigningKeyLine(String line) throws DescriptorParseException { if (!line.equals(Key.DIR_SIGNING_KEY.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); } }
- private void parseDirKeyCrosscertLine(String line, String[] parts) + private void parseDirKeyCrosscertLine(String line) throws DescriptorParseException { if (!line.equals(Key.DIR_KEY_CROSSCERT.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); } }
- private void parseDirKeyCertificationLine(String line, String[] parts) + private void parseDirKeyCertificationLine(String line) throws DescriptorParseException { if (!line.equals(Key.DIR_KEY_CERTIFICATION.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); diff --git a/src/main/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImpl.java b/src/main/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImpl.java index 99ea13e..d0e3d7e 100644 --- a/src/main/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImpl.java +++ b/src/main/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImpl.java @@ -86,158 +86,158 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl Key key = Key.get(partsNoOpt[0]); switch (key) { case EXTRA_INFO: - this.parseExtraInfoLine(line, lineNoOpt, partsNoOpt); + this.parseExtraInfoLine(line, partsNoOpt); break; case PUBLISHED: - this.parsePublishedLine(line, lineNoOpt, partsNoOpt); + this.parsePublishedLine(line, partsNoOpt); break; case READ_HISTORY: - this.parseReadHistoryLine(line, lineNoOpt, partsNoOpt); + this.parseReadHistoryLine(line, partsNoOpt); break; case WRITE_HISTORY: - this.parseWriteHistoryLine(line, lineNoOpt, partsNoOpt); + this.parseWriteHistoryLine(line, partsNoOpt); break; case GEOIP_DB_DIGEST: - this.parseGeoipDbDigestLine(line, lineNoOpt, partsNoOpt); + this.parseGeoipDbDigestLine(line, partsNoOpt); break; case GEOIP6_DB_DIGEST: - this.parseGeoip6DbDigestLine(line, lineNoOpt, partsNoOpt); + this.parseGeoip6DbDigestLine(line, partsNoOpt); break; case GEOIP_START_TIME: - this.parseGeoipStartTimeLine(line, lineNoOpt, partsNoOpt); + this.parseGeoipStartTimeLine(line, partsNoOpt); break; case GEOIP_CLIENT_ORIGINS: - this.parseGeoipClientOriginsLine(line, lineNoOpt, partsNoOpt); + this.parseGeoipClientOriginsLine(line, partsNoOpt); break; case DIRREQ_STATS_END: - this.parseDirreqStatsEndLine(line, lineNoOpt, partsNoOpt); + this.parseDirreqStatsEndLine(line, partsNoOpt); break; case DIRREQ_V2_IPS: - this.parseDirreqV2IpsLine(line, lineNoOpt, partsNoOpt); + this.parseDirreqV2IpsLine(line, partsNoOpt); break; case DIRREQ_V3_IPS: - this.parseDirreqV3IpsLine(line, lineNoOpt, partsNoOpt); + this.parseDirreqV3IpsLine(line, partsNoOpt); break; case DIRREQ_V2_REQS: - this.parseDirreqV2ReqsLine(line, lineNoOpt, partsNoOpt); + this.parseDirreqV2ReqsLine(line, partsNoOpt); break; case DIRREQ_V3_REQS: - this.parseDirreqV3ReqsLine(line, lineNoOpt, partsNoOpt); + this.parseDirreqV3ReqsLine(line, partsNoOpt); break; case DIRREQ_V2_SHARE: - this.parseDirreqV2ShareLine(line, lineNoOpt, partsNoOpt); + this.parseDirreqV2ShareLine(line, partsNoOpt); break; case DIRREQ_V3_SHARE: - this.parseDirreqV3ShareLine(line, lineNoOpt, partsNoOpt); + this.parseDirreqV3ShareLine(line, partsNoOpt); break; case DIRREQ_V2_RESP: - this.parseDirreqV2RespLine(line, lineNoOpt, partsNoOpt); + this.parseDirreqV2RespLine(line, partsNoOpt); break; case DIRREQ_V3_RESP: - this.parseDirreqV3RespLine(line, lineNoOpt, partsNoOpt); + this.parseDirreqV3RespLine(line, partsNoOpt); break; case DIRREQ_V2_DIRECT_DL: - this.parseDirreqV2DirectDlLine(line, lineNoOpt, partsNoOpt); + this.parseDirreqV2DirectDlLine(line, partsNoOpt); break; case DIRREQ_V3_DIRECT_DL: - this.parseDirreqV3DirectDlLine(line, lineNoOpt, partsNoOpt); + this.parseDirreqV3DirectDlLine(line, partsNoOpt); break; case DIRREQ_V2_TUNNELED_DL: - this.parseDirreqV2TunneledDlLine(line, lineNoOpt, partsNoOpt); + this.parseDirreqV2TunneledDlLine(line, partsNoOpt); break; case DIRREQ_V3_TUNNELED_DL: - this.parseDirreqV3TunneledDlLine(line, lineNoOpt, partsNoOpt); + this.parseDirreqV3TunneledDlLine(line, partsNoOpt); break; case DIRREQ_READ_HISTORY: - this.parseDirreqReadHistoryLine(line, lineNoOpt, partsNoOpt); + this.parseDirreqReadHistoryLine(line, partsNoOpt); break; case DIRREQ_WRITE_HISTORY: - this.parseDirreqWriteHistoryLine(line, lineNoOpt, partsNoOpt); + this.parseDirreqWriteHistoryLine(line, partsNoOpt); break; case ENTRY_STATS_END: - this.parseEntryStatsEndLine(line, lineNoOpt, partsNoOpt); + this.parseEntryStatsEndLine(line, partsNoOpt); break; case ENTRY_IPS: - this.parseEntryIpsLine(line, lineNoOpt, partsNoOpt); + this.parseEntryIpsLine(line, partsNoOpt); break; case CELL_STATS_END: - this.parseCellStatsEndLine(line, lineNoOpt, partsNoOpt); + this.parseCellStatsEndLine(line, partsNoOpt); break; case CELL_PROCESSED_CELLS: - this.parseCellProcessedCellsLine(line, lineNoOpt, partsNoOpt); + this.parseCellProcessedCellsLine(line, partsNoOpt); break; case CELL_QUEUED_CELLS: - this.parseCellQueuedCellsLine(line, lineNoOpt, partsNoOpt); + this.parseCellQueuedCellsLine(line, partsNoOpt); break; case CELL_TIME_IN_QUEUE: - this.parseCellTimeInQueueLine(line, lineNoOpt, partsNoOpt); + this.parseCellTimeInQueueLine(line, partsNoOpt); break; case CELL_CIRCUITS_PER_DECILE: - this.parseCellCircuitsPerDecileLine(line, lineNoOpt, + this.parseCellCircuitsPerDecileLine(line, partsNoOpt); break; case CONN_BI_DIRECT: - this.parseConnBiDirectLine(line, lineNoOpt, partsNoOpt); + this.parseConnBiDirectLine(line, partsNoOpt); break; case EXIT_STATS_END: - this.parseExitStatsEndLine(line, lineNoOpt, partsNoOpt); + this.parseExitStatsEndLine(line, partsNoOpt); break; case EXIT_KIBIBYTES_WRITTEN: - this.parseExitKibibytesWrittenLine(line, lineNoOpt, partsNoOpt); + this.parseExitKibibytesWrittenLine(line, partsNoOpt); break; case EXIT_KIBIBYTES_READ: - this.parseExitKibibytesReadLine(line, lineNoOpt, partsNoOpt); + this.parseExitKibibytesReadLine(line, partsNoOpt); break; case EXIT_STREAMS_OPENED: - this.parseExitStreamsOpenedLine(line, lineNoOpt, partsNoOpt); + this.parseExitStreamsOpenedLine(line, partsNoOpt); break; case BRIDGE_STATS_END: - this.parseBridgeStatsEndLine(line, lineNoOpt, partsNoOpt); + this.parseBridgeStatsEndLine(line, partsNoOpt); break; case BRIDGE_IPS: - this.parseBridgeStatsIpsLine(line, lineNoOpt, partsNoOpt); + this.parseBridgeStatsIpsLine(line, partsNoOpt); break; case BRIDGE_IP_VERSIONS: - this.parseBridgeIpVersionsLine(line, lineNoOpt, partsNoOpt); + this.parseBridgeIpVersionsLine(line, partsNoOpt); break; case BRIDGE_IP_TRANSPORTS: - this.parseBridgeIpTransportsLine(line, lineNoOpt, partsNoOpt); + this.parseBridgeIpTransportsLine(line, partsNoOpt); break; case TRANSPORT: - this.parseTransportLine(line, lineNoOpt, partsNoOpt); + this.parseTransportLine(line, partsNoOpt); break; case HIDSERV_STATS_END: - this.parseHidservStatsEndLine(line, lineNoOpt, partsNoOpt); + this.parseHidservStatsEndLine(line, partsNoOpt); break; case HIDSERV_REND_RELAYED_CELLS: - this.parseHidservRendRelayedCellsLine(line, lineNoOpt, + this.parseHidservRendRelayedCellsLine(line, partsNoOpt); break; case HIDSERV_DIR_ONIONS_SEEN: - this.parseHidservDirOnionsSeenLine(line, lineNoOpt, partsNoOpt); + this.parseHidservDirOnionsSeenLine(line, partsNoOpt); break; case PADDING_COUNTS: - this.parsePaddingCountsLine(line, lineNoOpt, partsNoOpt); + this.parsePaddingCountsLine(line, partsNoOpt); break; case IDENTITY_ED25519: - this.parseIdentityEd25519Line(line, lineNoOpt, partsNoOpt); + this.parseIdentityEd25519Line(line, partsNoOpt); nextCrypto = key; break; case MASTER_KEY_ED25519: - this.parseMasterKeyEd25519Line(line, lineNoOpt, partsNoOpt); + this.parseMasterKeyEd25519Line(line, partsNoOpt); break; case ROUTER_SIG_ED25519: - this.parseRouterSigEd25519Line(line, lineNoOpt, partsNoOpt); + this.parseRouterSigEd25519Line(line, partsNoOpt); break; case ROUTER_SIGNATURE: - this.parseRouterSignatureLine(line, lineNoOpt, partsNoOpt); + this.parseRouterSignatureLine(line, lineNoOpt); nextCrypto = key; break; case ROUTER_DIGEST: - this.parseRouterDigestLine(line, lineNoOpt, partsNoOpt); + this.parseRouterDigestLine(line, partsNoOpt); break; case ROUTER_DIGEST_SHA256: - this.parseRouterDigestSha256Line(line, lineNoOpt, partsNoOpt); + this.parseRouterDigestSha256Line(line, partsNoOpt); break; case CRYPTO_BEGIN: cryptoLines = new ArrayList<>(); @@ -281,7 +281,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl } }
- private void parseExtraInfoLine(String line, String lineNoOpt, + private void parseExtraInfoLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 3) { throw new DescriptorParseException("Illegal line '" + line @@ -292,25 +292,25 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl partsNoOpt[2]); }
- private void parsePublishedLine(String line, String lineNoOpt, + private void parsePublishedLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.publishedMillis = ParseHelper.parseTimestampAtIndex(line, partsNoOpt, 1, 2); }
- private void parseReadHistoryLine(String line, String lineNoOpt, + private void parseReadHistoryLine(String line, String[] partsNoOpt) throws DescriptorParseException { - this.readHistory = new BandwidthHistoryImpl(line, lineNoOpt, + this.readHistory = new BandwidthHistoryImpl(line, partsNoOpt); }
- private void parseWriteHistoryLine(String line, String lineNoOpt, + private void parseWriteHistoryLine(String line, String[] partsNoOpt) throws DescriptorParseException { - this.writeHistory = new BandwidthHistoryImpl(line, lineNoOpt, + this.writeHistory = new BandwidthHistoryImpl(line, partsNoOpt); }
- private void parseGeoipDbDigestLine(String line, String lineNoOpt, + private void parseGeoipDbDigestLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length < 2) { throw new DescriptorParseException("Illegal line '" + line @@ -320,7 +320,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl partsNoOpt[1]); }
- private void parseGeoip6DbDigestLine(String line, String lineNoOpt, + private void parseGeoip6DbDigestLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length < 2) { throw new DescriptorParseException("Illegal line '" + line @@ -330,7 +330,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl partsNoOpt[1]); }
- private void parseGeoipStartTimeLine(String line, String lineNoOpt, + private void parseGeoipStartTimeLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length < 3) { throw new DescriptorParseException("Illegal line '" + line @@ -340,14 +340,14 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl partsNoOpt, 1, 2); }
- private void parseGeoipClientOriginsLine(String line, String lineNoOpt, + private void parseGeoipClientOriginsLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.geoipClientOrigins = ParseHelper.parseCommaSeparatedKeyIntegerValueList(line, partsNoOpt, 1, 2); }
- private void parseDirreqStatsEndLine(String line, String lineNoOpt, + private void parseDirreqStatsEndLine(String line, String[] partsNoOpt) throws DescriptorParseException { long[] parsedStatsEndData = this.parseStatsEndLine(line, partsNoOpt, 5); @@ -373,38 +373,38 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl return result; }
- private void parseDirreqV2IpsLine(String line, String lineNoOpt, + private void parseDirreqV2IpsLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.dirreqV2Ips = ParseHelper.parseCommaSeparatedKeyIntegerValueList( line, partsNoOpt, 1, 2); }
- private void parseDirreqV3IpsLine(String line, String lineNoOpt, + private void parseDirreqV3IpsLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.dirreqV3Ips = ParseHelper.parseCommaSeparatedKeyIntegerValueList( line, partsNoOpt, 1, 2); }
- private void parseDirreqV2ReqsLine(String line, String lineNoOpt, + private void parseDirreqV2ReqsLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.dirreqV2Reqs = ParseHelper.parseCommaSeparatedKeyIntegerValueList(line, partsNoOpt, 1, 2); }
- private void parseDirreqV3ReqsLine(String line, String lineNoOpt, + private void parseDirreqV3ReqsLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.dirreqV3Reqs = ParseHelper.parseCommaSeparatedKeyIntegerValueList(line, partsNoOpt, 1, 2); }
- private void parseDirreqV2ShareLine(String line, String lineNoOpt, + private void parseDirreqV2ShareLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.dirreqV2Share = this.parseShareLine(line, partsNoOpt); }
- private void parseDirreqV3ShareLine(String line, String lineNoOpt, + private void parseDirreqV3ShareLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.dirreqV3Share = this.parseShareLine(line, partsNoOpt); } @@ -428,61 +428,61 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl return share; }
- private void parseDirreqV2RespLine(String line, String lineNoOpt, + private void parseDirreqV2RespLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.dirreqV2Resp = ParseHelper.parseCommaSeparatedKeyIntegerValueList(line, partsNoOpt, 1, 0); }
- private void parseDirreqV3RespLine(String line, String lineNoOpt, + private void parseDirreqV3RespLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.dirreqV3Resp = ParseHelper.parseCommaSeparatedKeyIntegerValueList(line, partsNoOpt, 1, 0); }
- private void parseDirreqV2DirectDlLine(String line, String lineNoOpt, + private void parseDirreqV2DirectDlLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.dirreqV2DirectDl = ParseHelper.parseCommaSeparatedKeyIntegerValueList(line, partsNoOpt, 1, 0); }
- private void parseDirreqV3DirectDlLine(String line, String lineNoOpt, + private void parseDirreqV3DirectDlLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.dirreqV3DirectDl = ParseHelper.parseCommaSeparatedKeyIntegerValueList(line, partsNoOpt, 1, 0); }
- private void parseDirreqV2TunneledDlLine(String line, String lineNoOpt, + private void parseDirreqV2TunneledDlLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.dirreqV2TunneledDl = ParseHelper.parseCommaSeparatedKeyIntegerValueList(line, partsNoOpt, 1, 0); }
- private void parseDirreqV3TunneledDlLine(String line, String lineNoOpt, + private void parseDirreqV3TunneledDlLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.dirreqV3TunneledDl = ParseHelper.parseCommaSeparatedKeyIntegerValueList( line,partsNoOpt, 1, 0); }
- private void parseDirreqReadHistoryLine(String line, String lineNoOpt, + private void parseDirreqReadHistoryLine(String line, String[] partsNoOpt) throws DescriptorParseException { - this.dirreqReadHistory = new BandwidthHistoryImpl(line, lineNoOpt, + this.dirreqReadHistory = new BandwidthHistoryImpl(line, partsNoOpt); }
- private void parseDirreqWriteHistoryLine(String line, String lineNoOpt, + private void parseDirreqWriteHistoryLine(String line, String[] partsNoOpt) throws DescriptorParseException { - this.dirreqWriteHistory = new BandwidthHistoryImpl(line, lineNoOpt, + this.dirreqWriteHistory = new BandwidthHistoryImpl(line, partsNoOpt); }
- private void parseEntryStatsEndLine(String line, String lineNoOpt, + private void parseEntryStatsEndLine(String line, String[] partsNoOpt) throws DescriptorParseException { long[] parsedStatsEndData = this.parseStatsEndLine(line, partsNoOpt, 5); @@ -490,13 +490,13 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl this.entryStatsIntervalLength = parsedStatsEndData[1]; }
- private void parseEntryIpsLine(String line, String lineNoOpt, + private void parseEntryIpsLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.entryIps = ParseHelper.parseCommaSeparatedKeyIntegerValueList( line, partsNoOpt, 1, 2); }
- private void parseCellStatsEndLine(String line, String lineNoOpt, + private void parseCellStatsEndLine(String line, String[] partsNoOpt) throws DescriptorParseException { long[] parsedStatsEndData = this.parseStatsEndLine(line, partsNoOpt, 5); @@ -504,7 +504,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl this.cellStatsIntervalLength = parsedStatsEndData[1]; }
- private void parseCellProcessedCellsLine(String line, String lineNoOpt, + private void parseCellProcessedCellsLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.cellProcessedCells = ParseHelper .parseCommaSeparatedIntegerValueList(line, partsNoOpt, 1); @@ -514,7 +514,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl } }
- private void parseCellQueuedCellsLine(String line, String lineNoOpt, + private void parseCellQueuedCellsLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.cellQueuedCells = ParseHelper.parseCommaSeparatedDoubleValueList( line, partsNoOpt, 1); @@ -524,7 +524,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl } }
- private void parseCellTimeInQueueLine(String line, String lineNoOpt, + private void parseCellTimeInQueueLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.cellTimeInQueue = ParseHelper .parseCommaSeparatedIntegerValueList(line, partsNoOpt, 1); @@ -535,7 +535,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl }
private void parseCellCircuitsPerDecileLine(String line, - String lineNoOpt, String[] partsNoOpt) + String[] partsNoOpt) throws DescriptorParseException { int circuits = -1; if (partsNoOpt.length >= 2) { @@ -551,7 +551,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl this.cellCircuitsPerDecile = circuits; }
- private void parseConnBiDirectLine(String line, String lineNoOpt, + private void parseConnBiDirectLine(String line, String[] partsNoOpt) throws DescriptorParseException { long[] parsedStatsEndData = this.parseStatsEndLine(line, partsNoOpt, 6); @@ -569,7 +569,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl this.connBiDirectBoth = parsedConnBiDirectStats[3]; }
- private void parseExitStatsEndLine(String line, String lineNoOpt, + private void parseExitStatsEndLine(String line, String[] partsNoOpt) throws DescriptorParseException { long[] parsedStatsEndData = this.parseStatsEndLine(line, partsNoOpt, 5); @@ -578,7 +578,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl }
private void parseExitKibibytesWrittenLine(String line, - String lineNoOpt, String[] partsNoOpt) + String[] partsNoOpt) throws DescriptorParseException { this.exitKibibytesWritten = this.sortByPorts(ParseHelper .parseCommaSeparatedKeyLongValueList(line, partsNoOpt, 1, 0)); @@ -586,7 +586,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl this.verifyBytesOrStreams(line, this.exitKibibytesWritten.values()); }
- private void parseExitKibibytesReadLine(String line, String lineNoOpt, + private void parseExitKibibytesReadLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.exitKibibytesRead = this.sortByPorts(ParseHelper .parseCommaSeparatedKeyLongValueList(line, partsNoOpt, 1, 0)); @@ -594,7 +594,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl this.verifyBytesOrStreams(line, this.exitKibibytesRead.values()); }
- private void parseExitStreamsOpenedLine(String line, String lineNoOpt, + private void parseExitStreamsOpenedLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.exitStreamsOpened = this.sortByPorts(ParseHelper .parseCommaSeparatedKeyLongValueList(line, partsNoOpt, 1, 0)); @@ -667,7 +667,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl } }
- private void parseBridgeStatsEndLine(String line, String lineNoOpt, + private void parseBridgeStatsEndLine(String line, String[] partsNoOpt) throws DescriptorParseException { long[] parsedStatsEndData = this.parseStatsEndLine(line, partsNoOpt, 5); @@ -675,28 +675,28 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl this.bridgeStatsIntervalLength = parsedStatsEndData[1]; }
- private void parseBridgeStatsIpsLine(String line, String lineNoOpt, + private void parseBridgeStatsIpsLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.bridgeIps = ParseHelper.parseCommaSeparatedKeyIntegerValueList(line, partsNoOpt, 1, 2); }
- private void parseBridgeIpVersionsLine(String line, String lineNoOpt, + private void parseBridgeIpVersionsLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.bridgeIpVersions = ParseHelper.parseCommaSeparatedKeyIntegerValueList(line, partsNoOpt, 1, 2); }
- private void parseBridgeIpTransportsLine(String line, String lineNoOpt, + private void parseBridgeIpTransportsLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.bridgeIpTransports = ParseHelper.parseCommaSeparatedKeyIntegerValueList(line, partsNoOpt, 1, 0); }
- private void parseTransportLine(String line, String lineNoOpt, + private void parseTransportLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length < 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -704,7 +704,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl this.transports.add(partsNoOpt[1]); }
- private void parseHidservStatsEndLine(String line, String lineNoOpt, + private void parseHidservStatsEndLine(String line, String[] partsNoOpt) throws DescriptorParseException { long[] parsedStatsEndData = this.parseStatsEndLine(line, partsNoOpt, 5); @@ -713,7 +713,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl }
private void parseHidservRendRelayedCellsLine(String line, - String lineNoOpt, String[] partsNoOpt) + String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length < 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -729,7 +729,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl }
private void parseHidservDirOnionsSeenLine(String line, - String lineNoOpt, String[] partsNoOpt) + String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length < 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -744,7 +744,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl partsNoOpt, 2); }
- private void parsePaddingCountsLine(String line, String lineNoOpt, + private void parsePaddingCountsLine(String line, String[] partsNoOpt) throws DescriptorParseException { long[] parsedStatsEndData = this.parseStatsEndLine(line, partsNoOpt, 6); @@ -754,14 +754,14 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl line, partsNoOpt, 5); }
- private void parseRouterSignatureLine(String line, String lineNoOpt, - String[] partsNoOpt) throws DescriptorParseException { + private void parseRouterSignatureLine(String line, String lineNoOpt) + throws DescriptorParseException { if (!lineNoOpt.equals("router-signature")) { throw new DescriptorParseException("Illegal line '" + line + "'."); } }
- private void parseRouterDigestLine(String line, String lineNoOpt, + private void parseRouterDigestLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -770,7 +770,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl partsNoOpt[1])); }
- private void parseIdentityEd25519Line(String line, String lineNoOpt, + private void parseIdentityEd25519Line(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 1) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -790,7 +790,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl this.masterKeyEd25519 = masterKeyEd25519FromIdentityEd25519; }
- private void parseMasterKeyEd25519Line(String line, String lineNoOpt, + private void parseMasterKeyEd25519Line(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -804,7 +804,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl this.masterKeyEd25519 = masterKeyEd25519FromMasterKeyEd25519Line; }
- private void parseRouterSigEd25519Line(String line, String lineNoOpt, + private void parseRouterSigEd25519Line(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -812,7 +812,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl this.routerSignatureEd25519 = partsNoOpt[1]; }
- private void parseRouterDigestSha256Line(String line, String lineNoOpt, + private void parseRouterDigestSha256Line(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); diff --git a/src/main/java/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java b/src/main/java/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java index f869918..4472875 100644 --- a/src/main/java/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java +++ b/src/main/java/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java @@ -95,10 +95,10 @@ public class NetworkStatusEntryImpl implements NetworkStatusEntry { this.parseALine(line, parts); break; case S: - this.parseSLine(line, parts); + this.parseSLine(parts); break; case V: - this.parseVLine(line, parts); + this.parseVLine(line); break; case PR: this.parsePrLine(line, parts); @@ -164,7 +164,7 @@ public class NetworkStatusEntryImpl implements NetworkStatusEntry {
private static Map<Integer, String> flagStrings = new HashMap<>();
- private void parseSLine(String line, String[] parts) + private void parseSLine(String[] parts) throws DescriptorParseException { this.parsedAtMostOnceKey(Key.S); BitSet flags = new BitSet(flagIndexes.size()); @@ -179,7 +179,7 @@ public class NetworkStatusEntryImpl implements NetworkStatusEntry { this.flags = flags; }
- private void parseVLine(String line, String[] parts) + private void parseVLine(String line) throws DescriptorParseException { this.parsedAtMostOnceKey(Key.V); String noOptLine = line; diff --git a/src/main/java/org/torproject/descriptor/impl/RelayDirectoryImpl.java b/src/main/java/org/torproject/descriptor/impl/RelayDirectoryImpl.java index 4c457f8..590b7ab 100644 --- a/src/main/java/org/torproject/descriptor/impl/RelayDirectoryImpl.java +++ b/src/main/java/org/torproject/descriptor/impl/RelayDirectoryImpl.java @@ -97,7 +97,7 @@ public class RelayDirectoryImpl extends DescriptorImpl Key key = Key.get(partsNoOpt[0]); switch (key) { case SIGNED_DIRECTORY: - this.parseSignedDirectoryLine(line, lineNoOpt, partsNoOpt); + this.parseSignedDirectoryLine(line, lineNoOpt); break; case PUBLISHED: if (publishedLine != null) { @@ -109,11 +109,11 @@ public class RelayDirectoryImpl extends DescriptorImpl } break; case DIR_SIGNING_KEY: - this.parseDirSigningKeyLine(line, lineNoOpt, partsNoOpt); + this.parseDirSigningKeyLine(line, partsNoOpt); nextCrypto = key; break; case RECOMMENDED_SOFTWARE: - this.parseRecommendedSoftwareLine(line, lineNoOpt, partsNoOpt); + this.parseRecommendedSoftwareLine(line, partsNoOpt); break; case RUNNING_ROUTERS: runningRoutersLine = line; @@ -157,7 +157,7 @@ public class RelayDirectoryImpl extends DescriptorImpl ? publishedLine.substring(Key.OPT.keyword.length() + 1) : publishedLine; String[] publishedPartsNoOpt = publishedLineNoOpt.split("[ \t]+"); - this.parsePublishedLine(publishedLine, publishedLineNoOpt, + this.parsePublishedLine(publishedLine, publishedPartsNoOpt); } if (routerStatusLine != null) { @@ -167,7 +167,7 @@ public class RelayDirectoryImpl extends DescriptorImpl : routerStatusLine; String[] routerStatusPartsNoOpt = routerStatusLineNoOpt.split("[ \t]+"); - this.parseRouterStatusLine(routerStatusLine, routerStatusLineNoOpt, + this.parseRouterStatusLine( routerStatusPartsNoOpt); } else if (runningRoutersLine != null) { String runningRoutersLineNoOpt = @@ -176,8 +176,8 @@ public class RelayDirectoryImpl extends DescriptorImpl : runningRoutersLine; String[] runningRoutersPartsNoOpt = runningRoutersLineNoOpt.split("[ \t]+"); - this.parseRunningRoutersLine(runningRoutersLine, - runningRoutersLineNoOpt, runningRoutersPartsNoOpt); + this.parseRunningRoutersLine( + runningRoutersPartsNoOpt); } else { throw new DescriptorParseException("Either running-routers or " + "router-status line must be given."); @@ -208,7 +208,7 @@ public class RelayDirectoryImpl extends DescriptorImpl Key key = Key.get(partsNoOpt[0]); switch (key) { case DIRECTORY_SIGNATURE: - this.parseDirectorySignatureLine(line, lineNoOpt, partsNoOpt); + this.parseDirectorySignatureLine(line, partsNoOpt); nextCrypto = key; break; case CRYPTO_BEGIN: @@ -240,20 +240,20 @@ public class RelayDirectoryImpl extends DescriptorImpl } }
- private void parseSignedDirectoryLine(String line, String lineNoOpt, - String[] partsNoOpt) throws DescriptorParseException { + private void parseSignedDirectoryLine(String line, String lineNoOpt) + throws DescriptorParseException { if (!lineNoOpt.equals(Key.SIGNED_DIRECTORY.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); } }
- private void parsePublishedLine(String line, String lineNoOpt, + private void parsePublishedLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.publishedMillis = ParseHelper.parseTimestampAtIndex(line, partsNoOpt, 1, 2); }
- private void parseDirSigningKeyLine(String line, String lineNoOpt, + private void parseDirSigningKeyLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length > 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -276,7 +276,7 @@ public class RelayDirectoryImpl extends DescriptorImpl } }
- private void parseRecommendedSoftwareLine(String line, String lineNoOpt, + private void parseRecommendedSoftwareLine(String line, String[] partsNoOpt) throws DescriptorParseException { List<String> result = new ArrayList<>(); if (partsNoOpt.length > 2) { @@ -296,8 +296,8 @@ public class RelayDirectoryImpl extends DescriptorImpl this.recommendedSoftware = result; }
- private void parseRunningRoutersLine(String line, String lineNoOpt, - String[] partsNoOpt) throws DescriptorParseException { + private void parseRunningRoutersLine(String[] partsNoOpt) + throws DescriptorParseException { for (int i = 1; i < partsNoOpt.length; i++) { String part = partsNoOpt[i]; String debugLine = "running-routers [...] " + part + " [...]"; @@ -322,8 +322,8 @@ public class RelayDirectoryImpl extends DescriptorImpl } }
- private void parseRouterStatusLine(String line, String lineNoOpt, - String[] partsNoOpt) throws DescriptorParseException { + private void parseRouterStatusLine(String[] partsNoOpt) + throws DescriptorParseException { for (int i = 1; i < partsNoOpt.length; i++) { String part = partsNoOpt[i]; String debugLine = "router-status [...] " + part + " [...]"; @@ -372,7 +372,7 @@ public class RelayDirectoryImpl extends DescriptorImpl } }
- private void parseDirectorySignatureLine(String line, String lineNoOpt, + private void parseDirectorySignatureLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length < 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); diff --git a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java index 6158a54..a531395 100644 --- a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java +++ b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java @@ -49,7 +49,7 @@ public class RelayNetworkStatusImpl extends NetworkStatusImpl Key key = Key.get(parts[0]); switch (key) { case NETWORK_STATUS_VERSION: - this.parseNetworkStatusVersionLine(line, parts); + this.parseNetworkStatusVersionLine(line); break; case DIR_SOURCE: this.parseDirSourceLine(line, parts); @@ -58,10 +58,10 @@ public class RelayNetworkStatusImpl extends NetworkStatusImpl this.parseFingerprintLine(line, parts); break; case CONTACT: - this.parseContactLine(line, parts); + this.parseContactLine(line); break; case DIR_SIGNING_KEY: - this.parseDirSigningKeyLine(line, parts); + this.parseDirSigningKeyLine(line); nextCrypto = key; break; case CLIENT_VERSIONS: @@ -74,7 +74,7 @@ public class RelayNetworkStatusImpl extends NetworkStatusImpl this.parsePublishedLine(line, parts); break; case DIR_OPTIONS: - this.parseDirOptionsLine(line, parts); + this.parseDirOptionsLine(parts); break; case CRYPTO_BEGIN: crypto = new StringBuilder(); @@ -154,7 +154,7 @@ public class RelayNetworkStatusImpl extends NetworkStatusImpl } }
- private void parseNetworkStatusVersionLine(String line, String[] parts) + private void parseNetworkStatusVersionLine(String line) throws DescriptorParseException { if (!line.equals(Key.NETWORK_STATUS_VERSION.keyword + SP + "2")) { throw new DescriptorParseException("Illegal network status version " @@ -188,7 +188,7 @@ public class RelayNetworkStatusImpl extends NetworkStatusImpl parts[1]); }
- private void parseContactLine(String line, String[] parts) + private void parseContactLine(String line) throws DescriptorParseException { if (line.length() > Key.CONTACT.keyword.length() + 1) { this.contactLine = line.substring(Key.CONTACT.keyword.length() + 1); @@ -197,7 +197,7 @@ public class RelayNetworkStatusImpl extends NetworkStatusImpl } }
- private void parseDirSigningKeyLine(String line, String[] parts) + private void parseDirSigningKeyLine(String line) throws DescriptorParseException { if (!line.equals(Key.DIR_SIGNING_KEY.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -222,7 +222,7 @@ public class RelayNetworkStatusImpl extends NetworkStatusImpl 1, 2); }
- private void parseDirOptionsLine(String line, String[] parts) + private void parseDirOptionsLine(String[] parts) throws DescriptorParseException { String[] dirOptions = new String[parts.length - 1]; for (int i = 1; i < parts.length; i++) { diff --git a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java index bc87c66..3373eaa 100644 --- a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java +++ b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java @@ -75,7 +75,7 @@ public class RelayNetworkStatusVoteImpl extends NetworkStatusImpl Key key = Key.get(parts[0]); switch (key) { case NETWORK_STATUS_VERSION: - this.parseNetworkStatusVersionLine(line, parts); + this.parseNetworkStatusVersionLine(line); break; case VOTE_STATUS: this.parseVoteStatusLine(line, parts); @@ -132,13 +132,13 @@ public class RelayNetworkStatusVoteImpl extends NetworkStatusImpl this.parseDirSourceLine(line, parts); break; case CONTACT: - this.parseContactLine(line, parts); + this.parseContactLine(line); break; case SHARED_RAND_PARTICIPATE: this.parseSharedRandParticipateLine(line, parts); break; case SHARED_RAND_COMMIT: - this.parseSharedRandCommitLine(line, parts); + this.parseSharedRandCommitLine(line); break; case SHARED_RAND_PREVIOUS_VALUE: this.parseSharedRandPreviousValueLine(line, parts); @@ -150,7 +150,8 @@ public class RelayNetworkStatusVoteImpl extends NetworkStatusImpl this.parseDirKeyCertificateVersionLine(line, parts); break; case DIR_ADDRESS: - this.parseDirAddressLine(line, parts); + /* Nothing new to learn here. Also, this line hasn't been observed + * "in the wild" yet. Maybe it's just an urban legend. */ break; case FINGERPRINT: this.parseFingerprintLine(line, parts); @@ -165,19 +166,19 @@ public class RelayNetworkStatusVoteImpl extends NetworkStatusImpl this.parseDirKeyExpiresLine(line, parts); break; case DIR_IDENTITY_KEY: - this.parseDirIdentityKeyLine(line, parts); + this.parseDirIdentityKeyLine(line); nextCrypto = key; break; case DIR_SIGNING_KEY: - this.parseDirSigningKeyLine(line, parts); + this.parseDirSigningKeyLine(line); nextCrypto = key; break; case DIR_KEY_CROSSCERT: - this.parseDirKeyCrosscertLine(line, parts); + this.parseDirKeyCrosscertLine(line); nextCrypto = key; break; case DIR_KEY_CERTIFICATION: - this.parseDirKeyCertificationLine(line, parts); + this.parseDirKeyCertificationLine(line); nextCrypto = key; break; case CRYPTO_BEGIN: @@ -220,7 +221,7 @@ public class RelayNetworkStatusVoteImpl extends NetworkStatusImpl } }
- private void parseNetworkStatusVersionLine(String line, String[] parts) + private void parseNetworkStatusVersionLine(String line) throws DescriptorParseException { if (!line.equals(Key.NETWORK_STATUS_VERSION.keyword + SP + "3")) { throw new DescriptorParseException("Illegal network status version " @@ -435,7 +436,7 @@ public class RelayNetworkStatusVoteImpl extends NetworkStatusImpl this.orPort = ParseHelper.parsePort(line, parts[6]); }
- private void parseContactLine(String line, String[] parts) + private void parseContactLine(String line) throws DescriptorParseException { if (line.length() > Key.CONTACT.keyword.length() + 1) { this.contactLine = line.substring(Key.CONTACT.keyword.length() + 1); @@ -453,7 +454,7 @@ public class RelayNetworkStatusVoteImpl extends NetworkStatusImpl this.sharedRandParticipate = true; }
- private void parseSharedRandCommitLine(String line, String[] parts) + private void parseSharedRandCommitLine(String line) throws DescriptorParseException { if (this.sharedRandCommitLines == null) { this.sharedRandCommitLines = new ArrayList<>(); @@ -509,11 +510,6 @@ public class RelayNetworkStatusVoteImpl extends NetworkStatusImpl } }
- private void parseDirAddressLine(String line, String[] parts) { - /* Nothing new to learn here. Also, this line hasn't been observed - * "in the wild" yet. Maybe it's just an urban legend. */ - } - private void parseFingerprintLine(String line, String[] parts) throws DescriptorParseException { /* Nothing new to learn here. We already know the fingerprint from @@ -547,28 +543,28 @@ public class RelayNetworkStatusVoteImpl extends NetworkStatusImpl parts, 1, 2); }
- private void parseDirIdentityKeyLine(String line, String[] parts) + private void parseDirIdentityKeyLine(String line) throws DescriptorParseException { if (!line.equals(Key.DIR_IDENTITY_KEY.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); } }
- private void parseDirSigningKeyLine(String line, String[] parts) + private void parseDirSigningKeyLine(String line) throws DescriptorParseException { if (!line.equals(Key.DIR_SIGNING_KEY.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); } }
- private void parseDirKeyCrosscertLine(String line, String[] parts) + private void parseDirKeyCrosscertLine(String line) throws DescriptorParseException { if (!line.equals(Key.DIR_KEY_CROSSCERT.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); } }
- private void parseDirKeyCertificationLine(String line, String[] parts) + private void parseDirKeyCertificationLine(String line) throws DescriptorParseException { if (!line.equals(Key.DIR_KEY_CERTIFICATION.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); diff --git a/src/main/java/org/torproject/descriptor/impl/ServerDescriptorImpl.java b/src/main/java/org/torproject/descriptor/impl/ServerDescriptorImpl.java index 9c9d47a..e3b2a17 100644 --- a/src/main/java/org/torproject/descriptor/impl/ServerDescriptorImpl.java +++ b/src/main/java/org/torproject/descriptor/impl/ServerDescriptorImpl.java @@ -67,38 +67,38 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl Key key = Key.get(partsNoOpt[0]); switch (key) { case ROUTER: - this.parseRouterLine(line, lineNoOpt, partsNoOpt); + this.parseRouterLine(line, partsNoOpt); break; case OR_ADDRESS: - this.parseOrAddressLine(line, lineNoOpt, partsNoOpt); + this.parseOrAddressLine(line, partsNoOpt); break; case BANDWIDTH: - this.parseBandwidthLine(line, lineNoOpt, partsNoOpt); + this.parseBandwidthLine(line, partsNoOpt); break; case PLATFORM: - this.parsePlatformLine(line, lineNoOpt, partsNoOpt); + this.parsePlatformLine(lineNoOpt); break; case PROTO: this.parseProtoLine(line, lineNoOpt, partsNoOpt); break; case PUBLISHED: - this.parsePublishedLine(line, lineNoOpt, partsNoOpt); + this.parsePublishedLine(line, partsNoOpt); break; case FINGERPRINT: - this.parseFingerprintLine(line, lineNoOpt, partsNoOpt); + this.parseFingerprintLine(line, lineNoOpt); break; case HIBERNATING: - this.parseHibernatingLine(line, lineNoOpt, partsNoOpt); + this.parseHibernatingLine(line, partsNoOpt); break; case UPTIME: - this.parseUptimeLine(line, lineNoOpt, partsNoOpt); + this.parseUptimeLine(line, partsNoOpt); break; case ONION_KEY: - this.parseOnionKeyLine(line, lineNoOpt, partsNoOpt); + this.parseOnionKeyLine(line, lineNoOpt); nextCrypto = key; break; case SIGNING_KEY: - this.parseSigningKeyLine(line, lineNoOpt, partsNoOpt); + this.parseSigningKeyLine(line, lineNoOpt); nextCrypto = key; break; case ACCEPT: @@ -108,74 +108,74 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl this.parseRejectLine(line, lineNoOpt, partsNoOpt); break; case ROUTER_SIGNATURE: - this.parseRouterSignatureLine(line, lineNoOpt, partsNoOpt); + this.parseRouterSignatureLine(line, lineNoOpt); nextCrypto = key; break; case CONTACT: - this.parseContactLine(line, lineNoOpt, partsNoOpt); + this.parseContactLine(lineNoOpt); break; case FAMILY: - this.parseFamilyLine(line, lineNoOpt, partsNoOpt); + this.parseFamilyLine(line, partsNoOpt); break; case READ_HISTORY: - this.parseReadHistoryLine(line, lineNoOpt, partsNoOpt); + this.parseReadHistoryLine(line, partsNoOpt); break; case WRITE_HISTORY: - this.parseWriteHistoryLine(line, lineNoOpt, partsNoOpt); + this.parseWriteHistoryLine(line, partsNoOpt); break; case EVENTDNS: - this.parseEventdnsLine(line, lineNoOpt, partsNoOpt); + this.parseEventdnsLine(line, partsNoOpt); break; case CACHES_EXTRA_INFO: - this.parseCachesExtraInfoLine(line, lineNoOpt, partsNoOpt); + this.parseCachesExtraInfoLine(line, lineNoOpt); break; case EXTRA_INFO_DIGEST: - this.parseExtraInfoDigestLine(line, lineNoOpt, partsNoOpt); + this.parseExtraInfoDigestLine(line, partsNoOpt); break; case HIDDEN_SERVICE_DIR: - this.parseHiddenServiceDirLine(line, lineNoOpt, partsNoOpt); + this.parseHiddenServiceDirLine(); break; case PROTOCOLS: - this.parseProtocolsLine(line, lineNoOpt, partsNoOpt); + this.parseProtocolsLine(line, partsNoOpt); break; case ALLOW_SINGLE_HOP_EXITS: - this.parseAllowSingleHopExitsLine(line, lineNoOpt, partsNoOpt); + this.parseAllowSingleHopExitsLine(line, lineNoOpt); break; case DIRCACHEPORT: - this.parseDircacheportLine(line, lineNoOpt, partsNoOpt); + this.parseDircacheportLine(line, partsNoOpt); break; case ROUTER_DIGEST: - this.parseRouterDigestLine(line, lineNoOpt, partsNoOpt); + this.parseRouterDigestLine(line, partsNoOpt); break; case ROUTER_DIGEST_SHA256: - this.parseRouterDigestSha256Line(line, lineNoOpt, partsNoOpt); + this.parseRouterDigestSha256Line(line, partsNoOpt); break; case IPV6_POLICY: - this.parseIpv6PolicyLine(line, lineNoOpt, partsNoOpt); + this.parseIpv6PolicyLine(line, partsNoOpt); break; case NTOR_ONION_KEY: - this.parseNtorOnionKeyLine(line, lineNoOpt, partsNoOpt); + this.parseNtorOnionKeyLine(line, partsNoOpt); break; case IDENTITY_ED25519: - this.parseIdentityEd25519Line(line, lineNoOpt, partsNoOpt); + this.parseIdentityEd25519Line(line, partsNoOpt); nextCrypto = key; break; case MASTER_KEY_ED25519: - this.parseMasterKeyEd25519Line(line, lineNoOpt, partsNoOpt); + this.parseMasterKeyEd25519Line(line, partsNoOpt); break; case ROUTER_SIG_ED25519: - this.parseRouterSigEd25519Line(line, lineNoOpt, partsNoOpt); + this.parseRouterSigEd25519Line(line, partsNoOpt); break; case ONION_KEY_CROSSCERT: - this.parseOnionKeyCrosscert(line, lineNoOpt, partsNoOpt); + this.parseOnionKeyCrosscert(line, partsNoOpt); nextCrypto = key; break; case NTOR_ONION_KEY_CROSSCERT: - this.parseNtorOnionKeyCrosscert(line, lineNoOpt, partsNoOpt); + this.parseNtorOnionKeyCrosscert(line, partsNoOpt); nextCrypto = key; break; case TUNNELLED_DIR_SERVER: - this.parseTunnelledDirServerLine(line, lineNoOpt, partsNoOpt); + this.parseTunnelledDirServerLine(line, lineNoOpt); break; case CRYPTO_BEGIN: cryptoLines = new ArrayList<>(); @@ -232,7 +232,7 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl } }
- private void parseRouterLine(String line, String lineNoOpt, + private void parseRouterLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 6) { throw new DescriptorParseException("Illegal line '" + line @@ -245,7 +245,7 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl this.dirPort = ParseHelper.parsePort(line, partsNoOpt[5]); }
- private void parseOrAddressLine(String line, String lineNoOpt, + private void parseOrAddressLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 2) { throw new DescriptorParseException("Wrong number of values in line " @@ -255,7 +255,7 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl this.orAddresses.add(partsNoOpt[1]); }
- private void parseBandwidthLine(String line, String lineNoOpt, + private void parseBandwidthLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length < 3 || partsNoOpt.length > 4) { throw new DescriptorParseException("Wrong number of values in line " @@ -286,8 +286,8 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl } }
- private void parsePlatformLine(String line, String lineNoOpt, - String[] partsNoOpt) throws DescriptorParseException { + private void parsePlatformLine(String lineNoOpt) + throws DescriptorParseException { if (lineNoOpt.length() > Key.PLATFORM.keyword.length() + 1) { this.platform = lineNoOpt.substring(Key.PLATFORM.keyword.length() + 1); } else { @@ -301,14 +301,14 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl partsNoOpt); }
- private void parsePublishedLine(String line, String lineNoOpt, + private void parsePublishedLine(String line, String[] partsNoOpt) throws DescriptorParseException { this.publishedMillis = ParseHelper.parseTimestampAtIndex(line, partsNoOpt, 1, 2); }
- private void parseFingerprintLine(String line, String lineNoOpt, - String[] partsNoOpt) throws DescriptorParseException { + private void parseFingerprintLine(String line, String lineNoOpt) + throws DescriptorParseException { if (lineNoOpt.length() != Key.FINGERPRINT.keyword.length() + 5 * 10) { throw new DescriptorParseException("Illegal line '" + line + "'."); } @@ -317,7 +317,7 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl .replaceAll(SP, "")); }
- private void parseHibernatingLine(String line, String lineNoOpt, + private void parseHibernatingLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -325,7 +325,7 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl this.hibernating = ParseHelper.parseBoolean(partsNoOpt[1], line); }
- private void parseUptimeLine(String line, String lineNoOpt, + private void parseUptimeLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 2) { throw new DescriptorParseException("Wrong number of values in line " @@ -344,15 +344,15 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl } }
- private void parseOnionKeyLine(String line, String lineNoOpt, - String[] partsNoOpt) throws DescriptorParseException { + private void parseOnionKeyLine(String line, String lineNoOpt) + throws DescriptorParseException { if (!lineNoOpt.equals(Key.ONION_KEY.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); } }
- private void parseSigningKeyLine(String line, String lineNoOpt, - String[] partsNoOpt) throws DescriptorParseException { + private void parseSigningKeyLine(String line, String lineNoOpt) + throws DescriptorParseException { if (!lineNoOpt.equals(Key.SIGNING_KEY.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); } @@ -377,15 +377,15 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl this.exitPolicyLines.add(lineNoOpt); }
- private void parseRouterSignatureLine(String line, String lineNoOpt, - String[] partsNoOpt) throws DescriptorParseException { + private void parseRouterSignatureLine(String line, String lineNoOpt) + throws DescriptorParseException { if (!lineNoOpt.equals(Key.ROUTER_SIGNATURE.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); } }
- private void parseContactLine(String line, String lineNoOpt, - String[] partsNoOpt) throws DescriptorParseException { + private void parseContactLine(String lineNoOpt) + throws DescriptorParseException { if (lineNoOpt.length() > Key.CONTACT.keyword.length() + 1) { this.contact = lineNoOpt.substring(Key.CONTACT.keyword.length() + 1); } else { @@ -393,7 +393,7 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl } }
- private void parseFamilyLine(String line, String lineNoOpt, + private void parseFamilyLine(String line, String[] partsNoOpt) throws DescriptorParseException { String[] familyEntries = new String[partsNoOpt.length - 1]; for (int i = 1; i < partsNoOpt.length; i++) { @@ -420,19 +420,17 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl this.familyEntries = familyEntries; }
- private void parseReadHistoryLine(String line, String lineNoOpt, - String[] partsNoOpt) throws DescriptorParseException { - this.readHistory = new BandwidthHistoryImpl(line, lineNoOpt, - partsNoOpt); + private void parseReadHistoryLine(String line, String[] partsNoOpt) + throws DescriptorParseException { + this.readHistory = new BandwidthHistoryImpl(line, partsNoOpt); }
- private void parseWriteHistoryLine(String line, String lineNoOpt, - String[] partsNoOpt) throws DescriptorParseException { - this.writeHistory = new BandwidthHistoryImpl(line, lineNoOpt, - partsNoOpt); + private void parseWriteHistoryLine(String line, String[] partsNoOpt) + throws DescriptorParseException { + this.writeHistory = new BandwidthHistoryImpl(line, partsNoOpt); }
- private void parseEventdnsLine(String line, String lineNoOpt, + private void parseEventdnsLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -441,15 +439,15 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl line); }
- private void parseCachesExtraInfoLine(String line, String lineNoOpt, - String[] partsNoOpt) throws DescriptorParseException { + private void parseCachesExtraInfoLine(String line, String lineNoOpt) + throws DescriptorParseException { if (!lineNoOpt.equals(Key.CACHES_EXTRA_INFO.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); } this.cachesExtraInfo = true; }
- private void parseExtraInfoDigestLine(String line, String lineNoOpt, + private void parseExtraInfoDigestLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length < 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -462,12 +460,11 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl } }
- private void parseHiddenServiceDirLine(String line, String lineNoOpt, - String[] partsNoOpt) { + private void parseHiddenServiceDirLine() { this.hiddenServiceDir = true; }
- private void parseProtocolsLine(String line, String lineNoOpt, + private void parseProtocolsLine(String line, String[] partsNoOpt) throws DescriptorParseException { int linkIndex = -1; int circuitIndex = -1; @@ -505,15 +502,15 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl } }
- private void parseAllowSingleHopExitsLine(String line, String lineNoOpt, - String[] partsNoOpt) throws DescriptorParseException { + private void parseAllowSingleHopExitsLine(String line, String lineNoOpt) + throws DescriptorParseException { if (!lineNoOpt.equals(Key.ALLOW_SINGLE_HOP_EXITS.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); } this.allowSingleHopExits = true; }
- private void parseDircacheportLine(String line, String lineNoOpt, + private void parseDircacheportLine(String line, String[] partsNoOpt) throws DescriptorParseException { /* The dircacheport line was only contained in server descriptors * published by Tor 0.0.8 and before. It's only specified in old @@ -528,7 +525,7 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl this.dirPort = ParseHelper.parsePort(line, partsNoOpt[1]); }
- private void parseRouterDigestLine(String line, String lineNoOpt, + private void parseRouterDigestLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -537,7 +534,7 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl line, partsNoOpt[1])); }
- private void parseIpv6PolicyLine(String line, String lineNoOpt, + private void parseIpv6PolicyLine(String line, String[] partsNoOpt) throws DescriptorParseException { boolean isValid = true; if (partsNoOpt.length != 3) { @@ -566,7 +563,7 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl } }
- private void parseNtorOnionKeyLine(String line, String lineNoOpt, + private void parseNtorOnionKeyLine(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -574,21 +571,21 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl this.ntorOnionKey = partsNoOpt[1].replaceAll("=", ""); }
- private void parseIdentityEd25519Line(String line, String lineNoOpt, + private void parseIdentityEd25519Line(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 1) { throw new DescriptorParseException("Illegal line '" + line + "'."); } }
- private void parseOnionKeyCrosscert(String line, String lineNoOpt, + private void parseOnionKeyCrosscert(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 1) { throw new DescriptorParseException("Illegal line '" + line + "'."); } }
- private void parseNtorOnionKeyCrosscert(String line, String lineNoOpt, + private void parseNtorOnionKeyCrosscert(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -600,8 +597,8 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl } }
- private void parseTunnelledDirServerLine(String line, String lineNoOpt, - String[] partsNoOpt) throws DescriptorParseException { + private void parseTunnelledDirServerLine(String line, String lineNoOpt) + throws DescriptorParseException { if (!lineNoOpt.equals(Key.TUNNELLED_DIR_SERVER.keyword)) { throw new DescriptorParseException("Illegal line '" + line + "'."); } @@ -621,7 +618,7 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl this.masterKeyEd25519 = masterKeyEd25519FromIdentityEd25519; }
- private void parseMasterKeyEd25519Line(String line, String lineNoOpt, + private void parseMasterKeyEd25519Line(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -635,7 +632,7 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl this.masterKeyEd25519 = masterKeyEd25519FromMasterKeyEd25519Line; }
- private void parseRouterSigEd25519Line(String line, String lineNoOpt, + private void parseRouterSigEd25519Line(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); @@ -643,7 +640,7 @@ public abstract class ServerDescriptorImpl extends DescriptorImpl this.routerSignatureEd25519 = partsNoOpt[1]; }
- private void parseRouterDigestSha256Line(String line, String lineNoOpt, + private void parseRouterDigestSha256Line(String line, String[] partsNoOpt) throws DescriptorParseException { if (partsNoOpt.length != 2) { throw new DescriptorParseException("Illegal line '" + line + "'."); diff --git a/src/main/java/org/torproject/descriptor/impl/TorperfResultImpl.java b/src/main/java/org/torproject/descriptor/impl/TorperfResultImpl.java index d61afec..de436b5 100644 --- a/src/main/java/org/torproject/descriptor/impl/TorperfResultImpl.java +++ b/src/main/java/org/torproject/descriptor/impl/TorperfResultImpl.java @@ -86,7 +86,7 @@ public class TorperfResultImpl extends DescriptorImpl String value = keyValueParts[1]; switch (key) { case "SOURCE": - this.parseSource(value, keyValue, line); + this.parseSource(value); break; case "FILESIZE": this.parseFileSize(value, keyValue, line); @@ -152,22 +152,22 @@ public class TorperfResultImpl extends DescriptorImpl this.parseUsedBy(value, keyValue, line); break; case "ENDPOINTLOCAL": - this.parseEndpointLocal(value, keyValue, line); + this.parseEndpointLocal(value); break; case "ENDPOINTPROXY": - this.parseEndpointProxy(value, keyValue, line); + this.parseEndpointProxy(value); break; case "ENDPOINTREMOTE": - this.parseEndpointRemote(value, keyValue, line); + this.parseEndpointRemote(value); break; case "HOSTNAMELOCAL": - this.parseHostnameLocal(value, keyValue, line); + this.parseHostnameLocal(value); break; case "HOSTNAMEREMOTE": - this.parseHostnameRemote(value, keyValue, line); + this.parseHostnameRemote(value); break; case "SOURCEADDRESS": - this.parseSourceAddress(value, keyValue, line); + this.parseSourceAddress(value); break; default: if (key.startsWith("DATAPERC")) { @@ -216,7 +216,7 @@ public class TorperfResultImpl extends DescriptorImpl } }
- private void parseSource(String value, String keyValue, String line) + private void parseSource(String value) throws DescriptorParseException { this.source = value; } @@ -378,27 +378,27 @@ public class TorperfResultImpl extends DescriptorImpl this.usedBy = this.parseInt(value, keyValue, line); }
- private void parseEndpointLocal(String value, String keyValue, String line) { + private void parseEndpointLocal(String value) { this.endpointLocal = value; }
- private void parseEndpointProxy(String value, String keyValue, String line) { + private void parseEndpointProxy(String value) { this.endpointProxy = value; }
- private void parseEndpointRemote(String value, String keyValue, String line) { + private void parseEndpointRemote(String value) { this.endpointRemote = value; }
- private void parseHostnameLocal(String value, String keyValue, String line) { + private void parseHostnameLocal(String value) { this.hostnameLocal = value; }
- private void parseHostnameRemote(String value, String keyValue, String line) { + private void parseHostnameRemote(String value) { this.hostnameRemote = value; }
- private void parseSourceAddress(String value, String keyValue, String line) { + private void parseSourceAddress(String value) { this.sourceAddress = value; }
tor-commits@lists.torproject.org