[tor-commits] [metrics-lib/master] Make all descriptor instances serializable.
karsten at torproject.org
karsten at torproject.org
Tue Mar 31 06:38:22 UTC 2020
commit e2fc2cb14dbd2ff6db0a062cdec2c9815bbbbb7f
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Thu Mar 12 22:21:24 2020 +0100
Make all descriptor instances serializable.
Implements #33090.
---
.../org/torproject/descriptor/BandwidthFile.java | 3 ++-
.../torproject/descriptor/BandwidthHistory.java | 3 ++-
.../java/org/torproject/descriptor/Descriptor.java | 3 ++-
.../org/torproject/descriptor/DirSourceEntry.java | 4 ++-
.../torproject/descriptor/DirectorySignature.java | 4 ++-
.../java/org/torproject/descriptor/ExitList.java | 3 ++-
.../torproject/descriptor/NetworkStatusEntry.java | 3 ++-
.../descriptor/impl/BandwidthHistoryImpl.java | 2 ++
.../impl/BridgeExtraInfoDescriptorImpl.java | 2 ++
.../descriptor/impl/BridgeNetworkStatusImpl.java | 2 ++
.../descriptor/impl/BridgePoolAssignmentImpl.java | 2 ++
.../impl/BridgeServerDescriptorImpl.java | 2 ++
.../descriptor/impl/BridgedbMetricsImpl.java | 2 ++
.../descriptor/impl/DirSourceEntryImpl.java | 2 ++
.../impl/DirectoryKeyCertificateImpl.java | 2 ++
.../descriptor/impl/DirectorySignatureImpl.java | 2 ++
.../descriptor/impl/ExitListEntryImpl.java | 2 ++
.../torproject/descriptor/impl/ExitListImpl.java | 2 ++
.../impl/ExitStatisticsPortComparator.java | 31 ++++++++++++++++++++++
.../descriptor/impl/ExtraInfoDescriptorImpl.java | 19 +++----------
.../torproject/descriptor/impl/KeyValueMap.java | 2 ++
.../descriptor/impl/MicrodescriptorImpl.java | 2 ++
.../descriptor/impl/NetworkStatusEntryImpl.java | 2 ++
.../descriptor/impl/NetworkStatusImpl.java | 2 ++
.../descriptor/impl/RelayDirectoryImpl.java | 2 ++
.../impl/RelayExtraInfoDescriptorImpl.java | 2 ++
.../impl/RelayNetworkStatusConsensusImpl.java | 2 ++
.../descriptor/impl/RelayNetworkStatusImpl.java | 2 ++
.../impl/RelayNetworkStatusVoteImpl.java | 2 ++
.../descriptor/impl/RelayServerDescriptorImpl.java | 2 ++
.../descriptor/impl/RouterStatusEntryImpl.java | 2 ++
.../descriptor/impl/ServerDescriptorImpl.java | 2 ++
.../descriptor/impl/SnowflakeStatsImpl.java | 2 ++
.../descriptor/impl/TorperfResultImpl.java | 2 ++
.../descriptor/impl/UnparseableDescriptorImpl.java | 2 ++
.../descriptor/log/WebServerAccessLogImpl.java | 2 ++
.../descriptor/log/WebServerAccessLogLine.java | 2 ++
37 files changed, 106 insertions(+), 23 deletions(-)
diff --git a/src/main/java/org/torproject/descriptor/BandwidthFile.java b/src/main/java/org/torproject/descriptor/BandwidthFile.java
index 25d738e..0ff8f85 100644
--- a/src/main/java/org/torproject/descriptor/BandwidthFile.java
+++ b/src/main/java/org/torproject/descriptor/BandwidthFile.java
@@ -3,6 +3,7 @@
package org.torproject.descriptor;
+import java.io.Serializable;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;
@@ -223,7 +224,7 @@ public interface BandwidthFile extends Descriptor {
*/
List<RelayLine> relayLines();
- interface RelayLine {
+ interface RelayLine extends Serializable {
/**
* Fingerprint for the relay's RSA identity key.
diff --git a/src/main/java/org/torproject/descriptor/BandwidthHistory.java b/src/main/java/org/torproject/descriptor/BandwidthHistory.java
index 7548185..ab63540 100644
--- a/src/main/java/org/torproject/descriptor/BandwidthHistory.java
+++ b/src/main/java/org/torproject/descriptor/BandwidthHistory.java
@@ -3,6 +3,7 @@
package org.torproject.descriptor;
+import java.io.Serializable;
import java.util.SortedMap;
/**
@@ -14,7 +15,7 @@ import java.util.SortedMap;
*
* @since 1.0.0
*/
-public interface BandwidthHistory {
+public interface BandwidthHistory extends Serializable {
/**
* Return the original bandwidth history line as contained in the
diff --git a/src/main/java/org/torproject/descriptor/Descriptor.java b/src/main/java/org/torproject/descriptor/Descriptor.java
index 5d2820c..7d01944 100644
--- a/src/main/java/org/torproject/descriptor/Descriptor.java
+++ b/src/main/java/org/torproject/descriptor/Descriptor.java
@@ -4,6 +4,7 @@
package org.torproject.descriptor;
import java.io.File;
+import java.io.Serializable;
import java.util.List;
/**
@@ -12,7 +13,7 @@ import java.util.List;
*
* @since 1.0.0
*/
-public interface Descriptor {
+public interface Descriptor extends Serializable {
/**
* Return the raw descriptor bytes.
diff --git a/src/main/java/org/torproject/descriptor/DirSourceEntry.java b/src/main/java/org/torproject/descriptor/DirSourceEntry.java
index daac9e4..781a5e6 100644
--- a/src/main/java/org/torproject/descriptor/DirSourceEntry.java
+++ b/src/main/java/org/torproject/descriptor/DirSourceEntry.java
@@ -3,6 +3,8 @@
package org.torproject.descriptor;
+import java.io.Serializable;
+
/**
* Contains details about an authority and its vote that contributed to a
* consensus.
@@ -13,7 +15,7 @@ package org.torproject.descriptor;
*
* @since 1.0.0
*/
-public interface DirSourceEntry {
+public interface DirSourceEntry extends Serializable {
/**
* Return the raw directory source entry bytes.
diff --git a/src/main/java/org/torproject/descriptor/DirectorySignature.java b/src/main/java/org/torproject/descriptor/DirectorySignature.java
index bc720a6..27a90fb 100644
--- a/src/main/java/org/torproject/descriptor/DirectorySignature.java
+++ b/src/main/java/org/torproject/descriptor/DirectorySignature.java
@@ -3,6 +3,8 @@
package org.torproject.descriptor;
+import java.io.Serializable;
+
/**
* Contains the signature of a network status consensus or vote.
*
@@ -13,7 +15,7 @@ package org.torproject.descriptor;
*
* @since 1.0.0
*/
-public interface DirectorySignature {
+public interface DirectorySignature extends Serializable {
/**
* Return the digest algorithm, which is "sha1" by default and which
diff --git a/src/main/java/org/torproject/descriptor/ExitList.java b/src/main/java/org/torproject/descriptor/ExitList.java
index 563ae4f..a4f81cd 100644
--- a/src/main/java/org/torproject/descriptor/ExitList.java
+++ b/src/main/java/org/torproject/descriptor/ExitList.java
@@ -3,6 +3,7 @@
package org.torproject.descriptor;
+import java.io.Serializable;
import java.util.Map;
import java.util.Set;
@@ -26,7 +27,7 @@ public interface ExitList extends Descriptor {
*
* @since 1.1.0
*/
- interface Entry {
+ interface Entry extends Serializable {
/**
* Return the scanned relay's fingerprint, which is a SHA-1 digest of
diff --git a/src/main/java/org/torproject/descriptor/NetworkStatusEntry.java b/src/main/java/org/torproject/descriptor/NetworkStatusEntry.java
index 5a2cae1..5360e4a 100644
--- a/src/main/java/org/torproject/descriptor/NetworkStatusEntry.java
+++ b/src/main/java/org/torproject/descriptor/NetworkStatusEntry.java
@@ -3,6 +3,7 @@
package org.torproject.descriptor;
+import java.io.Serializable;
import java.util.List;
import java.util.Set;
import java.util.SortedMap;
@@ -23,7 +24,7 @@ import java.util.SortedSet;
*
* @since 1.0.0
*/
-public interface NetworkStatusEntry {
+public interface NetworkStatusEntry extends Serializable {
/**
* Return the raw network status entry bytes.
diff --git a/src/main/java/org/torproject/descriptor/impl/BandwidthHistoryImpl.java b/src/main/java/org/torproject/descriptor/impl/BandwidthHistoryImpl.java
index 00a7732..03afc18 100644
--- a/src/main/java/org/torproject/descriptor/impl/BandwidthHistoryImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/BandwidthHistoryImpl.java
@@ -11,6 +11,8 @@ import java.util.TreeMap;
public class BandwidthHistoryImpl implements BandwidthHistory {
+ private static final long serialVersionUID = -5266052169817153234L;
+
protected BandwidthHistoryImpl(String line,
String[] partsNoOpt) throws DescriptorParseException {
boolean isValid = false;
diff --git a/src/main/java/org/torproject/descriptor/impl/BridgeExtraInfoDescriptorImpl.java b/src/main/java/org/torproject/descriptor/impl/BridgeExtraInfoDescriptorImpl.java
index 2865cf4..f8d5904 100644
--- a/src/main/java/org/torproject/descriptor/impl/BridgeExtraInfoDescriptorImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/BridgeExtraInfoDescriptorImpl.java
@@ -11,6 +11,8 @@ import java.io.File;
public class BridgeExtraInfoDescriptorImpl
extends ExtraInfoDescriptorImpl implements BridgeExtraInfoDescriptor {
+ private static final long serialVersionUID = -1458417007735415506L;
+
protected BridgeExtraInfoDescriptorImpl(byte[] descriptorBytes,
int[] offsetAndLimit, File descriptorFile)
throws DescriptorParseException {
diff --git a/src/main/java/org/torproject/descriptor/impl/BridgeNetworkStatusImpl.java b/src/main/java/org/torproject/descriptor/impl/BridgeNetworkStatusImpl.java
index 68b954f..719dec6 100644
--- a/src/main/java/org/torproject/descriptor/impl/BridgeNetworkStatusImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/BridgeNetworkStatusImpl.java
@@ -21,6 +21,8 @@ import java.util.TimeZone;
public class BridgeNetworkStatusImpl extends NetworkStatusImpl
implements BridgeNetworkStatus {
+ private static final long serialVersionUID = -6468907268677472808L;
+
protected BridgeNetworkStatusImpl(byte[] rawDescriptorBytes,
int[] offsetAndLength, File descriptorFile, String fileName)
throws DescriptorParseException {
diff --git a/src/main/java/org/torproject/descriptor/impl/BridgePoolAssignmentImpl.java b/src/main/java/org/torproject/descriptor/impl/BridgePoolAssignmentImpl.java
index 2fdad0b..89b0abc 100644
--- a/src/main/java/org/torproject/descriptor/impl/BridgePoolAssignmentImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/BridgePoolAssignmentImpl.java
@@ -15,6 +15,8 @@ import java.util.TreeMap;
public class BridgePoolAssignmentImpl extends DescriptorImpl
implements BridgePoolAssignment {
+ private static final long serialVersionUID = -8370471568586190472L;
+
protected BridgePoolAssignmentImpl(byte[] rawDescriptorBytes,
int[] offsetAndlength, File descriptorFile)
throws DescriptorParseException {
diff --git a/src/main/java/org/torproject/descriptor/impl/BridgeServerDescriptorImpl.java b/src/main/java/org/torproject/descriptor/impl/BridgeServerDescriptorImpl.java
index 4fcd548..3a8247e 100644
--- a/src/main/java/org/torproject/descriptor/impl/BridgeServerDescriptorImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/BridgeServerDescriptorImpl.java
@@ -11,6 +11,8 @@ import java.io.File;
public class BridgeServerDescriptorImpl extends ServerDescriptorImpl
implements BridgeServerDescriptor {
+ private static final long serialVersionUID = -9158883686763377765L;
+
protected BridgeServerDescriptorImpl(byte[] rawDescriptorBytes,
int[] offsetAndLength, File descriptorFile)
throws DescriptorParseException {
diff --git a/src/main/java/org/torproject/descriptor/impl/BridgedbMetricsImpl.java b/src/main/java/org/torproject/descriptor/impl/BridgedbMetricsImpl.java
index 431ab12..e1c09d1 100644
--- a/src/main/java/org/torproject/descriptor/impl/BridgedbMetricsImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/BridgedbMetricsImpl.java
@@ -20,6 +20,8 @@ import java.util.Set;
public class BridgedbMetricsImpl extends DescriptorImpl
implements BridgedbMetrics {
+ private static final long serialVersionUID = 3899169611574577173L;
+
private static final Set<Key> exactlyOnce = EnumSet.of(
Key.BRIDGEDB_METRICS_END, Key.BRIDGEDB_METRICS_VERSION);
diff --git a/src/main/java/org/torproject/descriptor/impl/DirSourceEntryImpl.java b/src/main/java/org/torproject/descriptor/impl/DirSourceEntryImpl.java
index 1e98b5a..54507e1 100644
--- a/src/main/java/org/torproject/descriptor/impl/DirSourceEntryImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/DirSourceEntryImpl.java
@@ -17,6 +17,8 @@ import java.util.Set;
public class DirSourceEntryImpl implements DirSourceEntry {
+ private static final long serialVersionUID = 7276698015074138852L;
+
private DescriptorImpl parent;
private int offset;
diff --git a/src/main/java/org/torproject/descriptor/impl/DirectoryKeyCertificateImpl.java b/src/main/java/org/torproject/descriptor/impl/DirectoryKeyCertificateImpl.java
index 1029c9b..10f2a08 100644
--- a/src/main/java/org/torproject/descriptor/impl/DirectoryKeyCertificateImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/DirectoryKeyCertificateImpl.java
@@ -15,6 +15,8 @@ import java.util.Set;
public class DirectoryKeyCertificateImpl extends DescriptorImpl
implements DirectoryKeyCertificate {
+ private static final long serialVersionUID = 1375140776886611946L;
+
protected DirectoryKeyCertificateImpl(byte[] rawDescriptorBytes,
int[] offsetAndLength, File descriptorFile)
throws DescriptorParseException {
diff --git a/src/main/java/org/torproject/descriptor/impl/DirectorySignatureImpl.java b/src/main/java/org/torproject/descriptor/impl/DirectorySignatureImpl.java
index 8f2bbb9..cd607dd 100644
--- a/src/main/java/org/torproject/descriptor/impl/DirectorySignatureImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/DirectorySignatureImpl.java
@@ -15,6 +15,8 @@ import java.util.Scanner;
public class DirectorySignatureImpl implements DirectorySignature {
+ private static final long serialVersionUID = -1084841439595622290L;
+
private DescriptorImpl parent;
private int offset;
diff --git a/src/main/java/org/torproject/descriptor/impl/ExitListEntryImpl.java b/src/main/java/org/torproject/descriptor/impl/ExitListEntryImpl.java
index f7f91df..b178007 100644
--- a/src/main/java/org/torproject/descriptor/impl/ExitListEntryImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/ExitListEntryImpl.java
@@ -16,6 +16,8 @@ import java.util.TreeSet;
public class ExitListEntryImpl implements ExitList.Entry {
+ private static final long serialVersionUID = 9014559583423738584L;
+
private String exitListEntryString;
private List<String> unrecognizedLines;
diff --git a/src/main/java/org/torproject/descriptor/impl/ExitListImpl.java b/src/main/java/org/torproject/descriptor/impl/ExitListImpl.java
index fd312d2..c4c0447 100644
--- a/src/main/java/org/torproject/descriptor/impl/ExitListImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/ExitListImpl.java
@@ -18,6 +18,8 @@ import java.util.TimeZone;
public class ExitListImpl extends DescriptorImpl implements ExitList {
+ private static final long serialVersionUID = 4227448935362502463L;
+
protected ExitListImpl(byte[] rawDescriptorBytes, File descriptorfile,
String fileName) throws DescriptorParseException {
super(rawDescriptorBytes, new int[] { 0, rawDescriptorBytes.length },
diff --git a/src/main/java/org/torproject/descriptor/impl/ExitStatisticsPortComparator.java b/src/main/java/org/torproject/descriptor/impl/ExitStatisticsPortComparator.java
new file mode 100644
index 0000000..e9601f9
--- /dev/null
+++ b/src/main/java/org/torproject/descriptor/impl/ExitStatisticsPortComparator.java
@@ -0,0 +1,31 @@
+/* Copyright 2020 The Tor Project
+ * See LICENSE for licensing information */
+
+package org.torproject.descriptor.impl;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+public class ExitStatisticsPortComparator implements Comparator<String>,
+ Serializable {
+
+ private static final long serialVersionUID = 636628160711742180L;
+
+ @Override
+ public int compare(String arg0, String arg1) {
+ int port0;
+ int port1;
+ try {
+ port1 = Integer.parseInt(arg1);
+ } catch (NumberFormatException e) {
+ return -1;
+ }
+ try {
+ port0 = Integer.parseInt(arg0);
+ } catch (NumberFormatException e) {
+ return 1;
+ }
+ return Integer.compare(port0, port1);
+ }
+}
+
diff --git a/src/main/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImpl.java b/src/main/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImpl.java
index 5880b0e..f02b540 100644
--- a/src/main/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImpl.java
@@ -23,6 +23,8 @@ import java.util.TreeMap;
public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl
implements ExtraInfoDescriptor {
+ private static final long serialVersionUID = -4720810362228341775L;
+
private Set<Key> exactlyOnceKeys = EnumSet.of(
Key.EXTRA_INFO, Key.PUBLISHED);
@@ -607,22 +609,7 @@ public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl
private SortedMap<String, Long> sortByPorts(
SortedMap<String, Long> naturalOrder) {
SortedMap<String, Long> byPortNumber =
- new TreeMap<>((arg0, arg1) -> {
- int port0;
- int port1;
- try {
- port1 = Integer.parseInt(arg1);
- } catch (NumberFormatException e) {
- return -1;
- }
- try {
- port0 = Integer.parseInt(arg0);
- } catch (NumberFormatException e) {
- return 1;
- }
- return Integer.compare(port0, port1);
- }
- );
+ new TreeMap<>(new ExitStatisticsPortComparator());
byPortNumber.putAll(naturalOrder);
return byPortNumber;
}
diff --git a/src/main/java/org/torproject/descriptor/impl/KeyValueMap.java b/src/main/java/org/torproject/descriptor/impl/KeyValueMap.java
index 23c4aa5..bac8e3a 100644
--- a/src/main/java/org/torproject/descriptor/impl/KeyValueMap.java
+++ b/src/main/java/org/torproject/descriptor/impl/KeyValueMap.java
@@ -11,6 +11,8 @@ import java.util.TreeMap;
public class KeyValueMap<T> extends TreeMap<String, T> {
+ private static final long serialVersionUID = 1124527355143605927L;
+
private Class<T> clazz;
public KeyValueMap(Class<T> clazz) {
diff --git a/src/main/java/org/torproject/descriptor/impl/MicrodescriptorImpl.java b/src/main/java/org/torproject/descriptor/impl/MicrodescriptorImpl.java
index fe965e5..87ab7ae 100644
--- a/src/main/java/org/torproject/descriptor/impl/MicrodescriptorImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/MicrodescriptorImpl.java
@@ -18,6 +18,8 @@ import java.util.Set;
public class MicrodescriptorImpl extends DescriptorImpl
implements Microdescriptor {
+ private static final long serialVersionUID = 7792584185486747094L;
+
protected MicrodescriptorImpl(byte[] descriptorBytes, int[] offsetAndLength,
File descriptorFile)
throws DescriptorParseException {
diff --git a/src/main/java/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java b/src/main/java/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java
index 5c65482..fe6cce5 100644
--- a/src/main/java/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java
@@ -23,6 +23,8 @@ import java.util.TreeSet;
public class NetworkStatusEntryImpl implements NetworkStatusEntry {
+ private static final long serialVersionUID = 8531564655041660420L;
+
private DescriptorImpl parent;
private int offset;
diff --git a/src/main/java/org/torproject/descriptor/impl/NetworkStatusImpl.java b/src/main/java/org/torproject/descriptor/impl/NetworkStatusImpl.java
index 4b160f5..bb2ca3a 100644
--- a/src/main/java/org/torproject/descriptor/impl/NetworkStatusImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/NetworkStatusImpl.java
@@ -21,6 +21,8 @@ import java.util.TreeMap;
* delegate the specific parts to the subclasses. */
public abstract class NetworkStatusImpl extends DescriptorImpl {
+ private static final long serialVersionUID = -2208207369822099643L;
+
protected Map<String, Integer> flagIndexes = new HashMap<>();
protected Map<Integer, String> flagStrings = new HashMap<>();
diff --git a/src/main/java/org/torproject/descriptor/impl/RelayDirectoryImpl.java b/src/main/java/org/torproject/descriptor/impl/RelayDirectoryImpl.java
index 94d256c..915d373 100644
--- a/src/main/java/org/torproject/descriptor/impl/RelayDirectoryImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/RelayDirectoryImpl.java
@@ -18,6 +18,8 @@ import java.util.Set;
public class RelayDirectoryImpl extends DescriptorImpl
implements RelayDirectory {
+ private static final long serialVersionUID = -6770225160489757961L;
+
protected RelayDirectoryImpl(byte[] directoryBytes, int[] offsetAndLength,
File descriptorFile) throws DescriptorParseException {
super(directoryBytes, offsetAndLength, descriptorFile, true);
diff --git a/src/main/java/org/torproject/descriptor/impl/RelayExtraInfoDescriptorImpl.java b/src/main/java/org/torproject/descriptor/impl/RelayExtraInfoDescriptorImpl.java
index fd56252..c2a0f7d 100644
--- a/src/main/java/org/torproject/descriptor/impl/RelayExtraInfoDescriptorImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/RelayExtraInfoDescriptorImpl.java
@@ -11,6 +11,8 @@ import java.io.File;
public class RelayExtraInfoDescriptorImpl
extends ExtraInfoDescriptorImpl implements RelayExtraInfoDescriptor {
+ private static final long serialVersionUID = 2526561625458492428L;
+
protected RelayExtraInfoDescriptorImpl(byte[] descriptorBytes,
int[] offsetAndLimit, File descriptorFile)
throws DescriptorParseException {
diff --git a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java
index 367865e..0c0342d 100644
--- a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java
@@ -22,6 +22,8 @@ import java.util.TreeSet;
public class RelayNetworkStatusConsensusImpl extends NetworkStatusImpl
implements RelayNetworkStatusConsensus {
+ private static final long serialVersionUID = -2852336205396172171L;
+
protected RelayNetworkStatusConsensusImpl(byte[] consensusBytes,
int[] offsetAndLimit, File descriptorFile)
throws DescriptorParseException {
diff --git a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java
index 5de8f70..aaabcf7 100644
--- a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java
@@ -19,6 +19,8 @@ import java.util.TreeSet;
public class RelayNetworkStatusImpl extends NetworkStatusImpl
implements RelayNetworkStatus {
+ private static final long serialVersionUID = 2872005332125710108L;
+
protected RelayNetworkStatusImpl(byte[] statusBytes, int[] offsetAndLength,
File descriptorFile) throws DescriptorParseException {
super(statusBytes, offsetAndLength, descriptorFile, true);
diff --git a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java
index e3fab9e..4add656 100644
--- a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java
@@ -23,6 +23,8 @@ import java.util.TreeSet;
public class RelayNetworkStatusVoteImpl extends NetworkStatusImpl
implements RelayNetworkStatusVote {
+ private static final long serialVersionUID = -39488588769922984L;
+
protected RelayNetworkStatusVoteImpl(byte[] voteBytes, int[] offsetAndLength,
File descriptorFile)
throws DescriptorParseException {
diff --git a/src/main/java/org/torproject/descriptor/impl/RelayServerDescriptorImpl.java b/src/main/java/org/torproject/descriptor/impl/RelayServerDescriptorImpl.java
index c920ac0..3ff8c66 100644
--- a/src/main/java/org/torproject/descriptor/impl/RelayServerDescriptorImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/RelayServerDescriptorImpl.java
@@ -11,6 +11,8 @@ import java.io.File;
public class RelayServerDescriptorImpl extends ServerDescriptorImpl
implements RelayServerDescriptor {
+ private static final long serialVersionUID = -8871465152198614055L;
+
protected RelayServerDescriptorImpl(byte[] descriptorBytes,
int[] offsetAndLength, File descriptorFile)
throws DescriptorParseException {
diff --git a/src/main/java/org/torproject/descriptor/impl/RouterStatusEntryImpl.java b/src/main/java/org/torproject/descriptor/impl/RouterStatusEntryImpl.java
index f5d31a1..fef4360 100644
--- a/src/main/java/org/torproject/descriptor/impl/RouterStatusEntryImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/RouterStatusEntryImpl.java
@@ -7,6 +7,8 @@ import org.torproject.descriptor.RouterStatusEntry;
public class RouterStatusEntryImpl implements RouterStatusEntry {
+ private static final long serialVersionUID = 4362115843485982121L;
+
protected RouterStatusEntryImpl(String fingerprint, String nickname,
boolean isLive, boolean isVerified) {
this.fingerprint = fingerprint;
diff --git a/src/main/java/org/torproject/descriptor/impl/ServerDescriptorImpl.java b/src/main/java/org/torproject/descriptor/impl/ServerDescriptorImpl.java
index 261c897..a6370e2 100644
--- a/src/main/java/org/torproject/descriptor/impl/ServerDescriptorImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/ServerDescriptorImpl.java
@@ -22,6 +22,8 @@ import java.util.SortedSet;
public abstract class ServerDescriptorImpl extends DescriptorImpl
implements ServerDescriptor {
+ private static final long serialVersionUID = 5240701284736998121L;
+
private static final Set<Key> atMostOnce = EnumSet.of(
Key.IDENTITY_ED25519, Key.MASTER_KEY_ED25519, Key.PLATFORM, Key.PROTO,
Key.FINGERPRINT, Key.HIBERNATING, Key.UPTIME, Key.CONTACT, Key.FAMILY,
diff --git a/src/main/java/org/torproject/descriptor/impl/SnowflakeStatsImpl.java b/src/main/java/org/torproject/descriptor/impl/SnowflakeStatsImpl.java
index 6552325..f52281e 100644
--- a/src/main/java/org/torproject/descriptor/impl/SnowflakeStatsImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/SnowflakeStatsImpl.java
@@ -19,6 +19,8 @@ import java.util.SortedMap;
public class SnowflakeStatsImpl extends DescriptorImpl
implements SnowflakeStats {
+ private static final long serialVersionUID = 5588809239715099933L;
+
private static final Set<Key> atMostOnce = EnumSet.of(
Key.SNOWFLAKE_IPS, Key.SNOWFLAKE_IPS_TOTAL, Key.SNOWFLAKE_IPS_STANDALONE,
Key.SNOWFLAKE_IPS_BADGE, Key.SNOWFLAKE_IPS_WEBEXT,
diff --git a/src/main/java/org/torproject/descriptor/impl/TorperfResultImpl.java b/src/main/java/org/torproject/descriptor/impl/TorperfResultImpl.java
index b883012..feb551b 100644
--- a/src/main/java/org/torproject/descriptor/impl/TorperfResultImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/TorperfResultImpl.java
@@ -21,6 +21,8 @@ import java.util.TreeMap;
public class TorperfResultImpl extends DescriptorImpl
implements TorperfResult {
+ private static final long serialVersionUID = 8961567618137500044L;
+
protected static List<Descriptor> parseTorperfResults(
byte[] rawDescriptorBytes, File descriptorFile)
throws DescriptorParseException {
diff --git a/src/main/java/org/torproject/descriptor/impl/UnparseableDescriptorImpl.java b/src/main/java/org/torproject/descriptor/impl/UnparseableDescriptorImpl.java
index fe10237..30e3a53 100644
--- a/src/main/java/org/torproject/descriptor/impl/UnparseableDescriptorImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/UnparseableDescriptorImpl.java
@@ -12,6 +12,8 @@ import java.util.List;
public class UnparseableDescriptorImpl extends DescriptorImpl
implements UnparseableDescriptor {
+ private static final long serialVersionUID = 7750009166142114121L;
+
protected UnparseableDescriptorImpl(byte[] rawDescriptorBytes,
int[] offsetAndLength, File descriptorFile,
DescriptorParseException descriptorParseException) {
diff --git a/src/main/java/org/torproject/descriptor/log/WebServerAccessLogImpl.java b/src/main/java/org/torproject/descriptor/log/WebServerAccessLogImpl.java
index 188f5b0..eb05413 100644
--- a/src/main/java/org/torproject/descriptor/log/WebServerAccessLogImpl.java
+++ b/src/main/java/org/torproject/descriptor/log/WebServerAccessLogImpl.java
@@ -33,6 +33,8 @@ import java.util.stream.Stream;
public class WebServerAccessLogImpl extends LogDescriptorImpl
implements InternalWebServerAccessLog, WebServerAccessLog {
+ private static final long serialVersionUID = 7528914359452568309L;
+
private static final Logger log
= LoggerFactory.getLogger(WebServerAccessLogImpl.class);
diff --git a/src/main/java/org/torproject/descriptor/log/WebServerAccessLogLine.java b/src/main/java/org/torproject/descriptor/log/WebServerAccessLogLine.java
index 3e19a75..445df9d 100644
--- a/src/main/java/org/torproject/descriptor/log/WebServerAccessLogLine.java
+++ b/src/main/java/org/torproject/descriptor/log/WebServerAccessLogLine.java
@@ -23,6 +23,8 @@ import java.util.regex.Pattern;
public class WebServerAccessLogLine implements WebServerAccessLog.Line {
+ private static final long serialVersionUID = 6160416810587561460L;
+
private static final Logger log = LoggerFactory
.getLogger(WebServerAccessLogLine.class);
More information about the tor-commits
mailing list