From ce5cef959bde11c981d77afbf3b8ad3e73f9aa54 Mon Sep 17 00:00:00 2001 From: Holger Friedrich Date: Sat, 26 Aug 2023 15:08:03 +0200 Subject: [PATCH] Migrate to java.nio.file.createTempFile (#3767) Use function from nio package as it uses more restrictive file permissions. Signed-off-by: Holger Friedrich --- .../java/org/openhab/core/audio/internal/AudioServlet.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioServlet.java b/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioServlet.java index fe5d448a9c0..f36fd82d46c 100644 --- a/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioServlet.java +++ b/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioServlet.java @@ -17,6 +17,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.file.Files; import java.util.Collections; import java.util.List; import java.util.Map; @@ -297,7 +298,7 @@ private AudioStream createClonableInputStream(AudioStream stream, String streamI clonableAudioStreamResult = new ByteArrayAudioStream(dataBytes, stream.getFormat()); } else { // in memory max size exceeded, sound is too long, we will use a file - File tempFile = File.createTempFile(streamId, ".snd"); + File tempFile = Files.createTempFile(streamId, ".snd").toFile(); tempFile.deleteOnExit(); try (OutputStream outputStream = new FileOutputStream(tempFile)) { // copy already read data to file :