Canonicalize file to where ChronicleMaps are persisted, to ensure CanonicalRandomAccessFiles work in the face of symbolic links provided to ChronicleMapBuilder (but unfortunately not hard links)

This commit is contained in:
leventov
2016-10-01 22:37:47 +03:00
parent 3b22bb5547
commit 4b1f11dd3a
@@ -1463,6 +1463,9 @@ public final class ChronicleMapBuilder<K, V> implements
replicated = replicationIdentifier != -1;
persisted = true;
// It's important to canonicalize the file, because CanonicalRandomAccessFiles.acquire()
// relies on java.io.File equality, which doesn't account symlinks itself.
file = file.getCanonicalFile();
if (!file.exists()) {
if (recover)
throw new FileNotFoundException("file " + file + " should exist for recovery");