From 0fed9278a04e31169ae4480e69d003e92a16dc9d Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <23113631+pixeebot@users.noreply.github.com> Date: Thu, 26 Oct 2023 05:05:54 +0000 Subject: [PATCH] Modernize and secure temp file creation --- src/main/java/com/amazonaws/services/neptune/rdf/Prefixes.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/amazonaws/services/neptune/rdf/Prefixes.java b/src/main/java/com/amazonaws/services/neptune/rdf/Prefixes.java index ae7f09a3..ee717030 100644 --- a/src/main/java/com/amazonaws/services/neptune/rdf/Prefixes.java +++ b/src/main/java/com/amazonaws/services/neptune/rdf/Prefixes.java @@ -12,6 +12,7 @@ package com.amazonaws.services.neptune.rdf; +import java.nio.file.Files; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.io.LineIterator; @@ -56,7 +57,7 @@ public void parse(String s, RDFWriter writer) { public void addTo(Path filePath) throws IOException { File source = filePath.toFile(); LineIterator lineIterator = FileUtils.lineIterator(source); - File tempFile = File.createTempFile(source.getName(), ".tmp"); + File tempFile = Files.createTempFile(source.getName(), ".tmp").toFile(); BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); try { writer.write(allHeaders());