This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push: new 8a69ea015f Avoid backup overwrite if they occur more than once every second 8a69ea015f is described below commit 8a69ea015fddc21b068f2e194ed247815cd19add Author: remm <r...@apache.org> AuthorDate: Tue Sep 24 09:50:07 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 ++++++++---- webapps/docs/changelog.xml | 4 ++++ 2 files changed, 12 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()); } /** diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index e765fefb62..a0c40eb70f 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -138,6 +138,10 @@ <code>null</code> if the <code>CallerPrincipalCallback</code> does not provide a Principal. (markt) </fix> + <fix> + Avoid store config backup loss when storing one configuration more than + once per second. (remm) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org