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

coheigea pushed a commit to branch coheigea/getDefaultTempDir
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 46f4e1c28bb5fe5bb0f9b5e7f75a9a17041abc12
Author: Colm O hEigeartaigh <[email protected]>
AuthorDate: Fri Nov 27 12:14:39 2026 +0000

    Recreate CXF's default temp directory if it is deleted at runtime
---
 core/src/main/java/org/apache/cxf/helpers/FileUtils.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/cxf/helpers/FileUtils.java 
b/core/src/main/java/org/apache/cxf/helpers/FileUtils.java
index 6795baf1b71..44894814f1c 100644
--- a/core/src/main/java/org/apache/cxf/helpers/FileUtils.java
+++ b/core/src/main/java/org/apache/cxf/helpers/FileUtils.java
@@ -84,7 +84,9 @@ public final class FileUtils {
                 defaultTempDir = f;
             }
         }
-        if (defaultTempDir == null) {
+        // also create a new directory if ours was removed, e.g. by a tmp 
cleaner, while the JVM was running.
+        // A fresh random directory is used rather than recreating the old, 
predictable path in a shared tmpdir
+        if (defaultTempDir == null || !exists(defaultTempDir)) {
             defaultTempDir = createTmpDir(false);
             if (shutdownHook != null) {
                 Runtime.getRuntime().removeShutdownHook(shutdownHook);

Reply via email to