This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 11.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push: new d30fe62911 Avoid backup overwrite if they occur more than once every second d30fe62911 is described below commit d30fe629110a03bc2614fb9acf28850910c3850f 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 2f12a45e50..eb16032d03 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