orbiter 18 years ago
parent 8e9bee12fc
commit 5d5e6ebfcc

@ -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();

@ -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) {

Loading…
Cancel
Save