From f6c1a7e6db846bfeb41797f580cde586bcb7d6bd Mon Sep 17 00:00:00 2001 From: CalDescent Date: Sat, 9 Oct 2021 11:38:13 +0100 Subject: [PATCH] Disregard exceptions in the bootstrap creation cleanup process because these don't affect the created bootstrap - instead just log the exception and full stack trace. --- .../java/org/qortal/repository/Bootstrap.java | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/qortal/repository/Bootstrap.java b/src/main/java/org/qortal/repository/Bootstrap.java index f82727fc..c3beab9e 100644 --- a/src/main/java/org/qortal/repository/Bootstrap.java +++ b/src/main/java/org/qortal/repository/Bootstrap.java @@ -278,21 +278,33 @@ public class Bootstrap { throw new DataException(String.format("Unable to create bootstrap due to timeout: %s", e.getMessage())); } finally { - LOGGER.info("Re-importing local data..."); - Path exportPath = HSQLDBImportExport.getExportDirectory(false); - repository.importDataFromFile(Paths.get(exportPath.toString(), "TradeBotStates.json").toString()); - repository.importDataFromFile(Paths.get(exportPath.toString(), "MintingAccounts.json").toString()); + try { + LOGGER.info("Re-importing local data..."); + Path exportPath = HSQLDBImportExport.getExportDirectory(false); + repository.importDataFromFile(Paths.get(exportPath.toString(), "TradeBotStates.json").toString()); + repository.importDataFromFile(Paths.get(exportPath.toString(), "MintingAccounts.json").toString()); + } catch (IOException e) { + LOGGER.info("Unable to re-import local data, but created bootstrap is still valid. {}", e); + } + + LOGGER.info("Unlocking blockchain..."); blockchainLock.unlock(); // Cleanup - if (inputPath != null) { - FileUtils.deleteDirectory(inputPath.toFile()); + LOGGER.info("Cleaning up..."); + try { + if (inputPath != null) { + FileUtils.deleteDirectory(inputPath.toFile()); + } + if (outputPath != null) { + FileUtils.deleteDirectory(outputPath.toFile()); + } + this.deleteAllTempDirectories(); + + } catch (IOException e) { + LOGGER.info("Error during cleanup, but created bootstrap is still valid. {}", e); } - if (outputPath != null) { - FileUtils.deleteDirectory(outputPath.toFile()); - } - this.deleteAllTempDirectories(); } }