You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2025/10/14 06:58:57 UTC

(tomcat) branch 10.1.x updated: Keep directory and directoryFile in sync

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

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

commit 89300c13ccd28dda5c248c1ef32ce8eec1c9afe9
Author: Mark Thomas <ma...@apache.org>
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 480ad436e3..a962051693 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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org