From 7d562013f7c312eccf2f805e2f075a4d07c7652a Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sun, 7 Apr 2019 14:47:46 -0500 Subject: [PATCH] Fixes https://github.com/bisq-network/bisq/issues/2660 --- .../src/main/java/bisq/common/storage/JsonFileManager.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/src/main/java/bisq/common/storage/JsonFileManager.java b/common/src/main/java/bisq/common/storage/JsonFileManager.java index d3070eea258..05532148fd9 100644 --- a/common/src/main/java/bisq/common/storage/JsonFileManager.java +++ b/common/src/main/java/bisq/common/storage/JsonFileManager.java @@ -79,6 +79,13 @@ public void writeToDisc(String json, String fileName) { printWriter = new PrintWriter(tempFile); printWriter.println(json); + // This close call and comment is borrowed from FileManager. Not 100% sure it that is really needed but + // seems that had fixed in the past and we got reported issues on Windows so that fix might be still + // required. + // Close resources before replacing file with temp file because otherwise it causes problems on windows + // when rename temp file + printWriter.close(); + FileUtil.renameFile(tempFile, jsonFile); } catch (Throwable t) { log.error("storageFile " + jsonFile.toString());