From 5f8e2f287e940bf5871cf3ef545f9bb428824ad4 Mon Sep 17 00:00:00 2001 From: Timm Fitschen <timm.fitschen@ds.mpg.de> Date: Wed, 27 Mar 2019 16:31:11 +0100 Subject: [PATCH] BUG: still buggy move files function --- src/main/java/caosdb/server/utils/FileUtils.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/caosdb/server/utils/FileUtils.java b/src/main/java/caosdb/server/utils/FileUtils.java index e332deac..87da9bcf 100644 --- a/src/main/java/caosdb/server/utils/FileUtils.java +++ b/src/main/java/caosdb/server/utils/FileUtils.java @@ -307,7 +307,7 @@ public class FileUtils { // must be stored somewhere until the transaction is done. final File tmp = File.createTempFile(target.getName(), Utils.getUID(), new File(FileSystem.getTmp())); - target.renameTo(tmp); + java.nio.file.Files.move(target.toPath(), tmp.toPath()); backup = tmp; } else { backup = null; @@ -322,7 +322,6 @@ public class FileUtils { public void undo() { try { java.nio.file.Files.move(target.toPath(), file.toPath()); - target.renameTo(file); if (_backup != null) { java.nio.file.Files.move(_backup.toPath(), target.toPath()); } -- GitLab