Skip to content

Commit

Permalink
try to fix bug with storage of settings
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1058 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Nov 11, 2005
1 parent f763923 commit 6e81f25
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
32 changes: 16 additions & 16 deletions source/de/anomic/server/serverFileUtils.java
Expand Up @@ -206,24 +206,24 @@ public static Map loadHashMap(File f) {
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) {
Expand Down
2 changes: 1 addition & 1 deletion source/de/anomic/yacy/yacySeedDB.java
Expand Up @@ -259,7 +259,7 @@ public yacySeed anySeedVersion(float minVersion) {
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;
Expand Down

0 comments on commit 6e81f25

Please sign in to comment.