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

[tor-commits] [metrics-lib/master] Also accept \r\n as newline in Torperf results files.



commit 0d6205af5dca0d652f1ee73025346ebf643831c7
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Fri Apr 15 16:39:16 2016 +0200

    Also accept \r\n as newline in Torperf results files.
---
 CHANGELOG.md                                              | 1 +
 src/org/torproject/descriptor/impl/TorperfResultImpl.java | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index d427621..091d35d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
  * Medium changes
    - Include the hostname in directory source entries of consensuses
      and votes.
+   - Also accept \r\n as newline in Torperf results files.
 
 
 # Changes in version 1.1.0 - 2015-12-28
diff --git a/src/org/torproject/descriptor/impl/TorperfResultImpl.java b/src/org/torproject/descriptor/impl/TorperfResultImpl.java
index 35eb356..cefbe94 100644
--- a/src/org/torproject/descriptor/impl/TorperfResultImpl.java
+++ b/src/org/torproject/descriptor/impl/TorperfResultImpl.java
@@ -26,7 +26,7 @@ public class TorperfResultImpl extends DescriptorImpl
     }
     List<Descriptor> parsedDescriptors = new ArrayList<>();
     String descriptorString = new String(rawDescriptorBytes);
-    Scanner s = new Scanner(descriptorString).useDelimiter("\n");
+    Scanner s = new Scanner(descriptorString).useDelimiter("\r?\n");
     String typeAnnotation = "";
     while (s.hasNext()) {
       String line = s.next();



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