From 018961ea775cff57b74aad49864799e53756ab13 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Mon, 30 Dec 2024 22:01:17 +0000 Subject: [PATCH] try to fix temp file docs git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1922789 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/util/DefaultTempFileCreationStrategy.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/poi/src/main/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java b/poi/src/main/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java index c4328edc7e..9b2e711ed4 100644 --- a/poi/src/main/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java +++ b/poi/src/main/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java @@ -32,8 +32,8 @@ import java.util.concurrent.locks.ReentrantLock; * Default implementation of the {@link TempFileCreationStrategy} used by {@link TempFile}: * Files are collected into one directory. * Files may be manually deleted by user prior to JVM exit. - * You can define the system property {@link #DELETE_FILES_ON_EXIT} and set to true if you want to - * delete any stray files on clean JVM exit. + * You can define the system property {@link #DELETE_FILES_ON_EXIT} if you want to + * delete any stray files on clean JVM exit (any non-empty value means add the deleteOnExit flag). * * The POI code should tidy up temp files when it no longer needs them. * The temporary directory is not deleted after the JVM exits. @@ -83,8 +83,8 @@ public class DefaultTempFileCreationStrategy implements TempFileCreationStrategy // Generate a unique new filename File newFile = Files.createTempFile(dir.toPath(), prefix, suffix).toFile(); - // Set the delete on exit flag if requested - if (Boolean.getBoolean(DELETE_FILES_ON_EXIT)) { + // Set the delete on exit flag if sys prop is set + if (System.getProperty(DELETE_FILES_ON_EXIT) != null) { newFile.deleteOnExit(); }