From 6fb87a7da318964d5ca9a504bd6638e93a41ce5c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9gory=20Mantelet?=
 <gregory.mantelet@astro.unistra.fr>
Date: Wed, 4 Jul 2018 09:53:41 +0200
Subject: [PATCH] [UWS,TAP] Follow-up to the previous commit: apply the fix
 also for each user's backup file.

The previous commit was only applied on the whole backup file.
---
 src/uws/service/file/LocalUWSFileManager.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/uws/service/file/LocalUWSFileManager.java b/src/uws/service/file/LocalUWSFileManager.java
index de2e936..35cb9d1 100644
--- a/src/uws/service/file/LocalUWSFileManager.java
+++ b/src/uws/service/file/LocalUWSFileManager.java
@@ -706,8 +706,9 @@ public class LocalUWSFileManager implements UWSFileManager {
 	@Override
 	public OutputStream getBackupOutput(JobOwner owner) throws IllegalArgumentException, IOException{
 		File backupFile = new File(getOwnerDirectory(owner), getBackupFileName(owner));
+		File tempBackupFile = new File(getOwnerDirectory(owner), getBackupFileName(owner) + ".temp-" + System.currentTimeMillis());
 		createParentDir(backupFile);
-		return new FileOutputStream(backupFile);
+		return new OutputStreamWithCloseAction(new FileOutputStream(tempBackupFile), new RotateFileAction(tempBackupFile, backupFile));
 	}
 
 	/**
-- 
GitLab