try to fix bug with storage of settings

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1058 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
orbiter 2005-11-11 08:41:13 +00:00
parent f763923e0a
commit 6e81f2580d
2 changed files with 17 additions and 17 deletions

View File

@ -206,24 +206,24 @@ public final class serverFileUtils {
return (Hashtable) prop;
}
public static void saveMap(File f, Map props, String comment) throws IOException {
public static void saveMap(File file, Map props, String comment) throws IOException {
PrintWriter pw = null;
try {
pw = new PrintWriter(new BufferedOutputStream(new FileOutputStream(f)));
pw.println("# " + comment);
Iterator i = props.entrySet().iterator();
String key, value;
Map.Entry entry;
while (i.hasNext()) {
entry = (Map.Entry) i.next();
key = (String) entry.getKey();
value = ((String) entry.getValue()).replaceAll("\n", "\\\\n");
pw.println(key + "=" + value);
}
pw.println("# EOF");
} finally {
if (pw!=null)try{pw.close();}catch(Exception e){}
File tf = new File(file.toString() + "." + (System.currentTimeMillis() % 1000));
pw = new PrintWriter(new BufferedOutputStream(new FileOutputStream(tf)));
pw.println("# " + comment);
Iterator i = props.entrySet().iterator();
String key, value;
Map.Entry entry;
while (i.hasNext()) {
entry = (Map.Entry) i.next();
key = (String) entry.getKey();
value = ((String) entry.getValue()).replaceAll("\n", "\\\\n");
pw.println(key + "=" + value);
}
pw.println("# EOF");
pw.close();
file.delete();
tf.renameTo(file);
}
public static void main(String[] args) {

View File

@ -259,7 +259,7 @@ public final class yacySeedDB {
int maxtry = seedActiveDB.size();
for (int i = 0; i < maxtry; i++) {
seed = (yacySeed) e.nextElement();
System.out.println("ENUMSEED: " + ((seed == null) ? "NULL" : seed.getName()));
System.out.println("ENUMSEED: " + ((seed == null) ? "NULL" : (seed.hash + ":" + seed.getName())));
if ((seed != null) && (seed.getVersion() >= minVersion)) return seed;
}
return null;