You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by ss...@apache.org on 2025/11/14 11:39:37 UTC

(xmlgraphics-fop) branch main updated: FOP-3284: Reduce access rights to temp files

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

ssteiner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/xmlgraphics-fop.git


The following commit(s) were added to refs/heads/main by this push:
     new 1927bfae9 FOP-3284: Reduce access rights to temp files
1927bfae9 is described below

commit 1927bfae96063ff603b217ce97ccb84532623517
Author: Simon Steiner <ss...@apache.org>
AuthorDate: Fri Nov 14 11:39:27 2025 +0000

    FOP-3284: Reduce access rights to temp files
---
 .../main/java/org/apache/fop/apps/io/ResourceResolverFactory.java    | 3 ++-
 fop-core/src/main/java/org/apache/fop/pdf/TempFileStreamCache.java   | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/fop-core/src/main/java/org/apache/fop/apps/io/ResourceResolverFactory.java b/fop-core/src/main/java/org/apache/fop/apps/io/ResourceResolverFactory.java
index 28b8c8b12..3412c36f8 100644
--- a/fop-core/src/main/java/org/apache/fop/apps/io/ResourceResolverFactory.java
+++ b/fop-core/src/main/java/org/apache/fop/apps/io/ResourceResolverFactory.java
@@ -26,6 +26,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.net.MalformedURLException;
 import java.net.URI;
+import java.nio.file.Files;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -176,7 +177,7 @@ public final class ResourceResolverFactory {
         }
 
         private File createTempFile(String path) throws IOException {
-            File tempFile = File.createTempFile(path, ".fop.tmp");
+            File tempFile = Files.createTempFile(path, ".fop.tmp").toFile();
             File oldFile = tempFiles.put(path, tempFile);
             if (oldFile != null) {
                 String errorMsg = oldFile.getAbsolutePath() + " has been already created for " + path;
diff --git a/fop-core/src/main/java/org/apache/fop/pdf/TempFileStreamCache.java b/fop-core/src/main/java/org/apache/fop/pdf/TempFileStreamCache.java
index 18a7a8b29..d8037fd8a 100644
--- a/fop-core/src/main/java/org/apache/fop/pdf/TempFileStreamCache.java
+++ b/fop-core/src/main/java/org/apache/fop/pdf/TempFileStreamCache.java
@@ -23,6 +23,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.nio.file.Files;
 
 import org.apache.commons.io.IOUtils;
 
@@ -47,8 +48,8 @@ public class TempFileStreamCache implements StreamCache {
      * @throws IOException if there is an IO error
      */
     public TempFileStreamCache() throws IOException {
-        tempFile = File.createTempFile("org.apache.fop.pdf.StreamCache-",
-                                       ".temp");
+        tempFile = Files.createTempFile("org.apache.fop.pdf.StreamCache-",
+                                       ".temp").toFile();
         tempFile.deleteOnExit();
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org