mirror of
https://github.com/yacy/yacy_search_server.git
synced 2026-10-25 05:54:15 +00:00
Write yacy.conf with alphabetically sorted keys
FileUtils.saveMap iterated a HashMap snapshot, so DATA/SETTINGS/yacy.conf was written in hash order and its key order changed between saves. Take the snapshot as a TreeMap so the file is written sorted by key, matching the order shown in ConfigProperties_p.html. Fixes #618
This commit is contained in:
2 files changed
+35
-1
No files matched your search
@@ -56,6 +56,7 @@ import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
@@ -539,7 +540,7 @@ public final class FileUtils {
|
||||
final Object lock = SAVE_MAP_LOCKS.computeIfAbsent(lockKey, k -> new Object());
|
||||
synchronized (lock) {
|
||||
/* Take the snapshot in write order so delayed callers cannot persist stale state. */
|
||||
final Map<String, String> propsCopy = new HashMap<>(props);
|
||||
final Map<String, String> propsCopy = new TreeMap<>(props);
|
||||
File tf = null;
|
||||
PrintWriter pw = null;
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user