This is an automated email from the ASF dual-hosted git repository.

markt 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 45b4d96fd0 Keep directory and directoryFile in sync
45b4d96fd0 is described below

commit 45b4d96fd0daef3bb2c0e355da5ccfbf2ec5638b
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Oct 14 07:58:33 2025 +0100

    Keep directory and directoryFile in sync
    
    Reported by Coverity Scan but unlikely to be an issue in real usage as
    configuration won't be changing at runtime (else all the sessions in the
    store would be lost)
---
 java/org/apache/catalina/session/FileStore.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/session/FileStore.java 
b/java/org/apache/catalina/session/FileStore.java
index 5685229cdd..9d21d2547e 100644
--- a/java/org/apache/catalina/session/FileStore.java
+++ b/java/org/apache/catalina/session/FileStore.java
@@ -61,7 +61,7 @@ public final class FileStore extends StoreBase {
      * The pathname of the directory in which Sessions are stored. This may be 
an absolute pathname, or a relative path
      * that is resolved against the temporary work directory for this 
application.
      */
-    private String directory = ".";
+    private volatile String directory = ".";
 
 
     /**
@@ -98,7 +98,7 @@ public final class FileStore extends StoreBase {
      *
      * @param path The new directory path
      */
-    public void setDirectory(String path) {
+    public synchronized void setDirectory(String path) {
         String oldDirectory = this.directory;
         this.directory = path;
         this.directoryFile = null;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to