From 5091d627bc2da00418d15abad0ea8cc4b7d590e7 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Thu, 11 Jul 2013 12:53:16 +0200 Subject: [PATCH] fixed parsing of peer flags --- source/net/yacy/peers/Seed.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/net/yacy/peers/Seed.java b/source/net/yacy/peers/Seed.java index e32b261e1..1f8c5a2a2 100644 --- a/source/net/yacy/peers/Seed.java +++ b/source/net/yacy/peers/Seed.java @@ -196,10 +196,10 @@ public class Seed implements Cloneable, Comparable, Comparator assert theHash != null; this.hash = theHash; this.dna = theDna; - final String flags = this.dna.get(Seed.FLAGS); - if ( (flags == null) || (flags.length() != 4) ) { - this.dna.put(Seed.FLAGS, Seed.FLAGSZERO); - } + String flags = this.dna.get(Seed.FLAGS); + if (flags == null) flags = Seed.FLAGSZERO; + while (flags.length() < 4) flags += " "; + this.dna.put(Seed.FLAGS, flags); this.dna.put(Seed.NAME, checkPeerName(get(Seed.NAME, "∅"))); this.birthdate = -1; // this means 'not yet parsed', parse that later when it is used } @@ -1007,6 +1007,7 @@ public class Seed implements Cloneable, Comparable, Comparator if ( testResult != null ) { throw new IOException("seed is not proper (" + testResult + "): " + resultSeed); } + //assert resultSeed.toString().equals(seed) : "\nresultSeed.toString() = " + resultSeed.toString() + ",\n seed = " + seed; // debug // seed ok return resultSeed; @@ -1092,7 +1093,8 @@ public class Seed implements Cloneable, Comparable, Comparator final ConcurrentMap copymap = new ConcurrentHashMap(); copymap.putAll(this.dna); copymap.put(Seed.HASH, this.hash); // set hash into seed code structure - return MapTools.map2string(copymap, ",", true); // generate string representation + String s = MapTools.map2string(copymap, ",", true); // generate string representation + return s; } public final String genSeedStr(final String key) {