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

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new c1f5061664 Keep directory and directoryFile in sync
c1f5061664 is described below

commit c1f506166443870812fb0788859760b2eb9b55db
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 c01eeecf41..4f8c96ab38 100644
--- a/java/org/apache/catalina/session/FileStore.java
+++ b/java/org/apache/catalina/session/FileStore.java
@@ -62,7 +62,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 = ".";
 
 
     /**
@@ -99,7 +99,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