This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new f44b8b64a8 Avoid backup overwrite if they occur more than once every second f44b8b64a8 is described below commit f44b8b64a8b2b9e764cf0d226277c60e4c4c1cce Author: remm <r...@apache.org> AuthorDate: Tue Sep 24 09:40:15 2024 +0200 Avoid backup overwrite if they occur more than once every second This would lose the original file. --- java/org/apache/catalina/storeconfig/StoreFileMover.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/java/org/apache/catalina/storeconfig/StoreFileMover.java b/java/org/apache/catalina/storeconfig/StoreFileMover.java index 9e245f5fc0..1e5e5dc775 100644 --- a/java/org/apache/catalina/storeconfig/StoreFileMover.java +++ b/java/org/apache/catalina/storeconfig/StoreFileMover.java @@ -150,10 +150,14 @@ public class StoreFileMover { } } String sb = getTimeTag(); - configSave = new File(configFile + sb); - if (!configSave.isAbsolute()) { - configSave = new File(getBasename(), configFile + sb); - } + int i = 0; + do { + configSave = new File(configFile + sb + "-" + String.valueOf(i)); + if (!configSave.isAbsolute()) { + configSave = new File(getBasename(), configFile + sb + "-" + String.valueOf(i)); + } + i++; + } while (configSave.exists()); } /** --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org