[tor-commits] [onionoo/release] Make two fixes to recently added version_status field.

karsten at torproject.org karsten at torproject.org
Fri Apr 6 09:46:44 UTC 2018


commit b1077620b1da3dd7a464ceb4e2957445b9e26415
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Thu Apr 5 22:20:19 2018 +0200

    Make two fixes to recently added version_status field.
    
     - Fix NullPointerException in cases where a relay/bridge does not
       report to have a (valid) tor version.
     - Set version_status field in bridge details documents, too.
---
 .../org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java     | 5 ++++-
 .../java/org/torproject/onionoo/writer/DetailsDocumentWriter.java    | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java b/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java
index b8bd4f6..6f9bdea 100644
--- a/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java
+++ b/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java
@@ -919,7 +919,10 @@ public class NodeDetailsStatusUpdater implements DescriptorListener,
       detailsStatus.setLastChangedOrAddressOrPort(
           nodeStatus.getLastChangedOrAddressOrPort());
       detailsStatus.setVersion(nodeStatus.getVersion());
-      detailsStatus.setVersionStatus(nodeStatus.getVersionStatus().toString());
+      if (null != nodeStatus.getVersionStatus()) {
+        detailsStatus.setVersionStatus(nodeStatus.getVersionStatus()
+            .toString());
+      }
 
       this.documentStore.store(detailsStatus, fingerprint);
       this.documentStore.store(nodeStatus, fingerprint);
diff --git a/src/main/java/org/torproject/onionoo/writer/DetailsDocumentWriter.java b/src/main/java/org/torproject/onionoo/writer/DetailsDocumentWriter.java
index eca7874..4aace51 100644
--- a/src/main/java/org/torproject/onionoo/writer/DetailsDocumentWriter.java
+++ b/src/main/java/org/torproject/onionoo/writer/DetailsDocumentWriter.java
@@ -194,6 +194,7 @@ public class DetailsDocumentWriter implements DocumentWriter {
     detailsDocument.setPlatform(detailsStatus.getPlatform());
     detailsDocument.setTransports(detailsStatus.getTransports());
     detailsDocument.setVersion(detailsStatus.getVersion());
+    detailsDocument.setVersionStatus(detailsStatus.getVersionStatus());
     this.documentStore.store(detailsDocument, fingerprint);
   }
 





More information about the tor-commits mailing list