[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [exonerator/master] Update to metrics-lib 1.9.0.



commit 407cbdc2ae0d03ec56817fdfab24eeec107f1534
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Sat Jun 17 17:09:51 2017 +0200

    Update to metrics-lib 1.9.0.
    
    Implements #22682.
---
 build.xml                                          |  2 +-
 .../exonerator/ExoneraTorDatabaseImporter.java     | 22 +++++++++-------------
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/build.xml b/build.xml
index 625be4a..f725e65 100644
--- a/build.xml
+++ b/build.xml
@@ -12,7 +12,7 @@
   <property name="webxmlfile" value="src/main/webapp/web.xml"/>
   <property name="warfile" value="${dist}/exonerator.war"/>
   <property name="source-and-target-java-version" value="1.7" />
-  <property name="descriptorversion" value="1.8.2" />
+  <property name="descriptorversion" value="1.9.0" />
   <path id="classpath">
     <pathelement path="${classes}"/>
     <fileset dir="${libs}">
diff --git a/src/main/java/org/torproject/exonerator/ExoneraTorDatabaseImporter.java b/src/main/java/org/torproject/exonerator/ExoneraTorDatabaseImporter.java
index 8930078..a36e242 100644
--- a/src/main/java/org/torproject/exonerator/ExoneraTorDatabaseImporter.java
+++ b/src/main/java/org/torproject/exonerator/ExoneraTorDatabaseImporter.java
@@ -5,7 +5,6 @@ package org.torproject.exonerator;
 
 import org.torproject.descriptor.Descriptor;
 import org.torproject.descriptor.DescriptorCollector;
-import org.torproject.descriptor.DescriptorFile;
 import org.torproject.descriptor.DescriptorReader;
 import org.torproject.descriptor.DescriptorSourceFactory;
 import org.torproject.descriptor.ExitList;
@@ -203,19 +202,16 @@ public class ExoneraTorDatabaseImporter {
   private static void parseDescriptors() {
     DescriptorReader descriptorReader =
         DescriptorSourceFactory.createDescriptorReader();
-    descriptorReader.addDirectory(new File(importDirString));
-    descriptorReader.setMaxDescriptorFilesInQueue(20);
+    descriptorReader.setMaxDescriptorsInQueue(20);
     descriptorReader.setExcludedFiles(lastImportHistory);
-    Iterator<DescriptorFile> descriptorFiles =
-        descriptorReader.readDescriptors();
-    while (descriptorFiles.hasNext()) {
-      DescriptorFile descriptorFile = descriptorFiles.next();
-      for (Descriptor descriptor : descriptorFile.getDescriptors()) {
-        if (descriptor instanceof RelayNetworkStatusConsensus) {
-          parseConsensus((RelayNetworkStatusConsensus) descriptor);
-        } else if (descriptor instanceof ExitList) {
-          parseExitList((ExitList) descriptor);
-        }
+    Iterator<Descriptor> descriptors = descriptorReader.readDescriptors(
+        new File(importDirString)).iterator();
+    while (descriptors.hasNext()) {
+      Descriptor descriptor = descriptors.next();
+      if (descriptor instanceof RelayNetworkStatusConsensus) {
+        parseConsensus((RelayNetworkStatusConsensus) descriptor);
+      } else if (descriptor instanceof ExitList) {
+        parseExitList((ExitList) descriptor);
       }
     }
     nextImportHistory.putAll(



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits