[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [metrics-db/master] Stop using deprecated parts of metrics-lib.
commit 0b398e9adbe7d6a56da3f8d0fa4bd52ff4f43308
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Thu Apr 14 10:01:03 2016 +0200
Stop using deprecated parts of metrics-lib.
We're currently using two metrics-lib types that have been deprecated:
- `org.torproject.descriptor.impl.DescriptorParseException` and
- `org.torproject.descriptor.ExitListEntry`.
It's easy to avoid using those parts and move to non-deprecated types.
This also removes the last dependency on a type in the impl package.
Implements #18818.
---
src/org/torproject/collector/exitlists/ExitListDownloader.java | 9 +++++----
src/org/torproject/collector/relaydescs/ArchiveWriter.java | 2 +-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/org/torproject/collector/exitlists/ExitListDownloader.java b/src/org/torproject/collector/exitlists/ExitListDownloader.java
index b5425fb..4f202d8 100644
--- a/src/org/torproject/collector/exitlists/ExitListDownloader.java
+++ b/src/org/torproject/collector/exitlists/ExitListDownloader.java
@@ -24,8 +24,7 @@ import org.torproject.descriptor.Descriptor;
import org.torproject.descriptor.DescriptorParser;
import org.torproject.descriptor.DescriptorSourceFactory;
import org.torproject.descriptor.ExitList;
-import org.torproject.descriptor.ExitListEntry;
-import org.torproject.descriptor.impl.DescriptorParseException;
+import org.torproject.descriptor.DescriptorParseException;
import org.torproject.collector.main.Configuration;
import org.torproject.collector.main.LockFile;
import org.torproject.collector.main.LoggingConfiguration;
@@ -128,8 +127,10 @@ public class ExitListDownloader extends Thread {
return;
}
ExitList parsedExitList = (ExitList) parsedDescriptors.get(0);
- for (ExitListEntry entry : parsedExitList.getExitListEntries()) {
- maxScanMillis = Math.max(maxScanMillis, entry.getScanMillis());
+ for (ExitList.Entry entry : parsedExitList.getEntries()) {
+ for (long scanMillis : entry.getExitAddresses().values()) {
+ maxScanMillis = Math.max(maxScanMillis, scanMillis);
+ }
}
} catch (DescriptorParseException e) {
logger.log(Level.WARNING, "Could not parse downloaded exit list",
diff --git a/src/org/torproject/collector/relaydescs/ArchiveWriter.java b/src/org/torproject/collector/relaydescs/ArchiveWriter.java
index 560687c..da83bd1 100644
--- a/src/org/torproject/collector/relaydescs/ArchiveWriter.java
+++ b/src/org/torproject/collector/relaydescs/ArchiveWriter.java
@@ -29,7 +29,7 @@ import java.util.logging.Logger;
import org.torproject.descriptor.DescriptorParser;
import org.torproject.descriptor.DescriptorSourceFactory;
-import org.torproject.descriptor.impl.DescriptorParseException;
+import org.torproject.descriptor.DescriptorParseException;
import org.torproject.collector.main.Configuration;
import org.torproject.collector.main.LockFile;
import org.torproject.collector.main.LoggingConfiguration;
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits