Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

try to fix bug with storage of settings

orbiter6e81f2580deb
diff --git a/source/de/anomic/server/serverFileUtils.java b/source/de/anomic/server/serverFileUtils.java
index 088115683..87f760ab5 100644
--- a/source/de/anomic/server/serverFileUtils.java
+++ b/source/de/anomic/server/serverFileUtils.java
@@ -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) {
diff --git a/source/de/anomic/yacy/yacySeedDB.java b/source/de/anomic/yacy/yacySeedDB.java
index a8e744c67..9a59df265 100644
--- a/source/de/anomic/yacy/yacySeedDB.java
+++ b/source/de/anomic/yacy/yacySeedDB.java
@@ -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;