aboutsummaryrefslogtreecommitdiffstats
path: root/poi-examples
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2022-12-28 08:08:09 +0000
committerPJ Fanning <fanningpj@apache.org>2022-12-28 08:08:09 +0000
commit1def0cba387d8c869a371768ee3c1c3415de6336 (patch)
treeb0ec42fa8a52206684ecb2aa3b7b8e5e23200d4f /poi-examples
parent215da1a1edd11f5afe18793068880c8943cfabb3 (diff)
downloadpoi-1def0cba387d8c869a371768ee3c1c3415de6336.tar.gz
poi-1def0cba387d8c869a371768ee3c1c3415de6336.zip
[bug-66397] update temp file code. Thanks to lsq27.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1906238 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-examples')
-rw-r--r--poi-examples/src/main/java/org/apache/poi/examples/util/TempFileUtils.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/poi-examples/src/main/java/org/apache/poi/examples/util/TempFileUtils.java b/poi-examples/src/main/java/org/apache/poi/examples/util/TempFileUtils.java
index 7d2d01b409..ac6fa02e58 100644
--- a/poi-examples/src/main/java/org/apache/poi/examples/util/TempFileUtils.java
+++ b/poi-examples/src/main/java/org/apache/poi/examples/util/TempFileUtils.java
@@ -19,18 +19,19 @@
package org.apache.poi.examples.util;
-import java.io.File;
-
+import org.apache.poi.util.DefaultTempFileCreationStrategy;
import org.apache.poi.util.TempFile;
+import java.io.File;
+import java.nio.file.Paths;
+
public final class TempFileUtils {
private TempFileUtils() {
}
@SuppressWarnings("java:S106")
public static void checkTempFiles() {
- String tmpDir = System.getProperty(TempFile.JAVA_IO_TMPDIR) + "/poifiles";
- File tempDir = new File(tmpDir);
+ File tempDir = Paths.get(System.getProperty(TempFile.JAVA_IO_TMPDIR), DefaultTempFileCreationStrategy.POIFILES).toFile();
if(tempDir.exists()) {
String[] tempFiles = tempDir.list();
if(tempFiles != null && tempFiles.length > 0) {