diff --git a/source/de/anomic/server/serverCodings.java b/source/de/anomic/server/serverCodings.java index 50198165c..bd48a266c 100644 --- a/source/de/anomic/server/serverCodings.java +++ b/source/de/anomic/server/serverCodings.java @@ -50,6 +50,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.security.MessageDigest; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -175,10 +176,10 @@ public final class serverCodings { return p; } - public static HashMap string2map(String string, String separator) { + public static Map string2map(String string, String separator) { // this can be used to parse a Map.toString() into a Map again if (string == null) return null; - HashMap map = new HashMap(); + Map map = Collections.synchronizedMap(new HashMap()); int pos; if ((pos = string.indexOf("{")) >= 0) string = string.substring(pos + 1).trim(); if ((pos = string.lastIndexOf("}")) >= 0) string = string.substring(0, pos).trim(); @@ -210,7 +211,7 @@ public final class serverCodings { public static Set string2set(String string, String separator) { // this can be used to parse a Map.toString() into a Map again if (string == null) return null; - HashSet set = new HashSet(); + Set set = Collections.synchronizedSet(new HashSet()); int pos; if ((pos = string.indexOf("{")) >= 0) string = string.substring(pos + 1).trim(); if ((pos = string.lastIndexOf("}")) >= 0) string = string.substring(0, pos).trim(); diff --git a/source/de/anomic/yacy/yacySeed.java b/source/de/anomic/yacy/yacySeed.java index a5e97e38c..f8da02b53 100644 --- a/source/de/anomic/yacy/yacySeed.java +++ b/source/de/anomic/yacy/yacySeed.java @@ -64,6 +64,7 @@ import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.net.InetAddress; +import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -164,7 +165,7 @@ public class yacySeed { } public yacySeed(String theHash) { - this.dna = new HashMap(); + this.dna = Collections.synchronizedMap(new HashMap()); // settings that can only be computed by originating peer: // at first startup - @@ -616,7 +617,7 @@ public class yacySeed { if (seedStr == null) { return null; } final String seed = crypt.simpleDecode(seedStr, key); if (seed == null) { return null; } - final HashMap dna = serverCodings.string2map(seed, ","); + final Map dna = serverCodings.string2map(seed, ","); final String hash = (String) dna.remove(yacySeed.HASH); final yacySeed resultSeed = new yacySeed(hash, dna); if (properTest) {