From 1def0cba387d8c869a371768ee3c1c3415de6336 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Wed, 28 Dec 2022 08:08:09 +0000 Subject: [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 --- .../main/java/org/apache/poi/examples/util/TempFileUtils.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'poi-examples/src') 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) { -- cgit v1.2.3