[tor-commits] [metrics-lib/master] Add a real fix for the 682f6e0 bug.
karsten at torproject.org
karsten at torproject.org
Fri Dec 16 08:32:50 UTC 2011
commit 15ddbf715c5c8ff1451d76b9d46a4f60c16d0d1d
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Fri Dec 16 09:31:58 2011 +0100
Add a real fix for the 682f6e0 bug.
---
.../descriptor/impl/NetworkStatusImpl.java | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/org/torproject/descriptor/impl/NetworkStatusImpl.java b/src/org/torproject/descriptor/impl/NetworkStatusImpl.java
index 898d127..f478913 100644
--- a/src/org/torproject/descriptor/impl/NetworkStatusImpl.java
+++ b/src/org/torproject/descriptor/impl/NetworkStatusImpl.java
@@ -170,11 +170,11 @@ public abstract class NetworkStatusImpl {
List<byte[]> splitParts = new ArrayList<byte[]>();
int from = start;
while (from < end) {
- int to = descriptorString.indexOf("\n" + keyword, from);
- /* Searching for "\nkeyword" instead of "\nkeyword " or
- * "\nkeyword\n" seems fragile. Workaround is to check for
- * to > end, but that's really a hack. */
- if (to > end || to < 0) {
+ int to = descriptorString.indexOf("\n" + keyword + " ", from);
+ if (to < 0) {
+ to = descriptorString.indexOf("\n" + keyword + "\n", from);
+ }
+ if (to < 0) {
to = end;
} else {
to += 1;
More information about the tor-commits
mailing list