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)
diff --git a/java/org/apache/catalina/session/FileStore.java b/java/org/apache/catalina/session/FileStore.java
index 5685229..9d21d25 100644
--- a/java/org/apache/catalina/session/FileStore.java
+++ b/java/org/apache/catalina/session/FileStore.java
@@ -61,7 +61,7 @@
* 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 @@
*
* @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;