assortment files are now not deleted, but shifted to a backup directory.

See also: http://www.yacy-forum.de/viewtopic.php?p=15458#15458

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1394 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 7366e39dd3
commit bb2095fe39

@ -50,7 +50,6 @@ import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;

@ -210,7 +210,19 @@ public final class plasmaWordIndexAssortment {
if (assortments != null) try {
assortments.close();
} catch (IOException e) {}
if (!(assortmentFile.delete())) throw new RuntimeException("cannot delete assortment database");
try {
// make a back-up
File backupPath = new File(assortmentFile.getParentFile(), "ABKP");
if (!(backupPath.exists())) backupPath.mkdirs();
File backupFile = new File(backupPath, assortmentFile.getName() + System.currentTimeMillis());
assortmentFile.renameTo(backupFile);
log.logInfo("a back-up of the deleted assortment file is in " + backupFile.toString());
} catch (Exception e) {
// if this fails, delete the file
if (!(assortmentFile.delete())) throw new RuntimeException("cannot delete assortment database");
}
if (assortmentFile.exists()) assortmentFile.delete();
assortments = new kelondroTree(assortmentFile, bufferSize, bufferStructure(assortmentLength), true);
}

Loading…
Cancel
Save