Refactor: use FileUtil.removeAndBackupFile instead of FileManager.removeAndBackupFile

This commit is contained in:
chimp1984 2020-10-01 16:53:06 -05:00
parent 937c006d73
commit fd0cc63e7c
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
2 changed files with 8 additions and 8 deletions

View File

@ -39,7 +39,7 @@ import bisq.network.p2p.seed.SeedNodeRepository;
import bisq.common.UserThread;
import bisq.common.config.Config;
import bisq.common.crypto.Hash;
import bisq.common.storage.FileManager;
import bisq.common.file.FileUtil;
import bisq.common.util.Utilities;
import javax.inject.Inject;
@ -419,7 +419,7 @@ public class DaoStateMonitoringService implements DaoSetupService, DaoStateListe
File corrupted = new File(storageDir, storeName);
try {
if (corrupted.exists()) {
FileManager.removeAndBackupFile(storageDir, corrupted, newFileName, backupDirName);
FileUtil.removeAndBackupFile(storageDir, corrupted, newFileName, backupDirName);
}
} catch (Throwable t) {
t.printStackTrace();

View File

@ -26,7 +26,7 @@ import bisq.network.p2p.storage.persistence.StoreService;
import bisq.common.UserThread;
import bisq.common.config.Config;
import bisq.common.storage.FileManager;
import bisq.common.file.FileUtil;
import bisq.common.storage.Storage;
import javax.inject.Inject;
@ -114,20 +114,20 @@ public class DaoStateStorageService extends StoreService<DaoStateStore> {
long currentTime = System.currentTimeMillis();
String backupDirName = "out_of_sync_dao_data";
String newFileName = "BlindVoteStore_" + currentTime;
FileManager.removeAndBackupFile(storageDir, new File(storageDir, "BlindVoteStore"), newFileName, backupDirName);
FileUtil.removeAndBackupFile(storageDir, new File(storageDir, "BlindVoteStore"), newFileName, backupDirName);
newFileName = "ProposalStore_" + currentTime;
FileManager.removeAndBackupFile(storageDir, new File(storageDir, "ProposalStore"), newFileName, backupDirName);
FileUtil.removeAndBackupFile(storageDir, new File(storageDir, "ProposalStore"), newFileName, backupDirName);
// We also need to remove ballot list as it contains the proposals as well. It will be recreated at resync
newFileName = "BallotList_" + currentTime;
FileManager.removeAndBackupFile(storageDir, new File(storageDir, "BallotList"), newFileName, backupDirName);
FileUtil.removeAndBackupFile(storageDir, new File(storageDir, "BallotList"), newFileName, backupDirName);
newFileName = "UnconfirmedBsqChangeOutputList_" + currentTime;
FileManager.removeAndBackupFile(storageDir, new File(storageDir, "UnconfirmedBsqChangeOutputList"), newFileName, backupDirName);
FileUtil.removeAndBackupFile(storageDir, new File(storageDir, "UnconfirmedBsqChangeOutputList"), newFileName, backupDirName);
newFileName = "DaoStateStore_" + currentTime;
FileManager.removeAndBackupFile(storageDir, new File(storageDir, "DaoStateStore"), newFileName, backupDirName);
FileUtil.removeAndBackupFile(storageDir, new File(storageDir, "DaoStateStore"), newFileName, backupDirName);
}