From 0e6efc52f26ce5a2dd170b6e0f7bc78ba7320806 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Wed, 26 Jan 2022 19:40:47 +0000 Subject: [PATCH] [bug-65849] file attributes may cause issues on windows git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1897516 13f79535-47bb-0310-9956-ffa450edef68 --- .../util/DefaultTempFileCreationStrategy.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 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 b5ff8afbeb..342bbeb4f5 100644 --- a/poi/src/main/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java +++ b/poi/src/main/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java @@ -22,11 +22,6 @@ import static org.apache.poi.util.TempFile.JAVA_IO_TMPDIR; import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.nio.file.attribute.FileAttribute; -import java.nio.file.attribute.PosixFilePermission; -import java.nio.file.attribute.PosixFilePermissions; -import java.util.HashSet; -import java.util.Set; /** * Default implementation of the {@link TempFileCreationStrategy} used by {@link TempFile}: @@ -46,8 +41,6 @@ public class DefaultTempFileCreationStrategy implements TempFileCreationStrategy /** To use files.deleteOnExit after clean JVM exit, set the -Dpoi.delete.tmp.files.on.exit JVM property */ public static final String DELETE_FILES_ON_EXIT = "poi.delete.tmp.files.on.exit"; - private final FileAttribute> userPermissions; - /** The directory where the temporary files will be created (null to use the default directory). */ private File dir; @@ -69,10 +62,6 @@ public class DefaultTempFileCreationStrategy implements TempFileCreationStrategy */ public DefaultTempFileCreationStrategy(File dir) { this.dir = dir; - Set permissions = new HashSet<>(); - permissions.add(PosixFilePermission.OWNER_READ); - permissions.add(PosixFilePermission.OWNER_WRITE); - userPermissions = PosixFilePermissions.asFileAttribute(permissions); } private void createPOIFilesDirectory() throws IOException { @@ -115,10 +104,7 @@ public class DefaultTempFileCreationStrategy implements TempFileCreationStrategy createPOIFilesDirectory(); // Generate a unique new filename - HashSet permissions = new HashSet<>(); - permissions.add(PosixFilePermission.OWNER_READ); - permissions.add(PosixFilePermission.OWNER_WRITE); - File newFile = Files.createTempFile(dir.toPath(), prefix, suffix, userPermissions).toFile(); + File newFile = Files.createTempFile(dir.toPath(), prefix, suffix).toFile(); // Set the delete on exit flag, but only when explicitly disabled if (System.getProperty(DELETE_FILES_ON_EXIT) != null) { -- 2.39.5