From b41bc5887774794151f0a1378c39cbb84a3f5784 Mon Sep 17 00:00:00 2001 From: Luke Sikina Date: Thu, 28 Nov 2024 11:56:22 -0500 Subject: [PATCH] [ALS-7199] Files mved from tomcat's tmp dir to a mounted fs failed to delete --- .../avillach/hpds/service/filesharing/FileSystemService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/filesharing/FileSystemService.java b/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/filesharing/FileSystemService.java index 7a0f9a77..fffb7196 100644 --- a/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/filesharing/FileSystemService.java +++ b/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/filesharing/FileSystemService.java @@ -53,7 +53,10 @@ private boolean moveFile(String destinationName, Path sourceFile, String queryId try { LOG.info("Moving query {} to file: {}", queryId, filePath); makeDirIfDNE(dirPath); - Path result = Files.move(sourceFile, filePath, REPLACE_EXISTING); + Path result = Files.copy(sourceFile, filePath, REPLACE_EXISTING); + // we have to copy and then delete because of how mv works with mounted drives + // (it doesn't work) + Files.delete(sourceFile); return Files.exists(result); } catch (IOException e) { LOG.error("Error moving.", e);