diff --git a/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/handler/PullJob.java b/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/handler/PullJob.java index 6dc411702c7..84275f8218b 100644 --- a/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/handler/PullJob.java +++ b/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/handler/PullJob.java @@ -143,7 +143,7 @@ class PullJob implements Runnable { File tmpTargetFile; try { - tmpTargetFile = File.createTempFile(TMP_FILE_PREFIX, null); + tmpTargetFile = Files.createTempFile(TMP_FILE_PREFIX, null).toFile(); } catch (IOException e) { logger.warn("Not able to create temporary file for downloading iCal. Error message is: {}", e.getMessage()); return; diff --git a/bundles/org.openhab.voice.mactts/src/main/java/org/openhab/voice/mactts/internal/MacTTSAudioStream.java b/bundles/org.openhab.voice.mactts/src/main/java/org/openhab/voice/mactts/internal/MacTTSAudioStream.java index b83dcdae4ba..c6bfeb29e07 100644 --- a/bundles/org.openhab.voice.mactts/src/main/java/org/openhab/voice/mactts/internal/MacTTSAudioStream.java +++ b/bundles/org.openhab.voice.mactts/src/main/java/org/openhab/voice/mactts/internal/MacTTSAudioStream.java @@ -17,6 +17,7 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; import org.openhab.core.audio.AudioException; import org.openhab.core.audio.AudioFormat; @@ -130,7 +131,7 @@ class MacTTSAudioStream extends FixedLengthAudioStream implements Disposable { private String generateOutputFilename() throws AudioException { File tempFile; try { - tempFile = File.createTempFile(Integer.toString(text.hashCode()), ".wav"); + tempFile = Files.createTempFile(Integer.toString(text.hashCode()), ".wav").toFile(); tempFile.deleteOnExit(); } catch (IOException e) { throw new AudioException("Unable to create temp file.", e); diff --git a/bundles/org.openhab.voice.picotts/src/main/java/org/openhab/voice/picotts/internal/PicoTTSAudioStream.java b/bundles/org.openhab.voice.picotts/src/main/java/org/openhab/voice/picotts/internal/PicoTTSAudioStream.java index da384f443c3..5d0c5288323 100644 --- a/bundles/org.openhab.voice.picotts/src/main/java/org/openhab/voice/picotts/internal/PicoTTSAudioStream.java +++ b/bundles/org.openhab.voice.picotts/src/main/java/org/openhab/voice/picotts/internal/PicoTTSAudioStream.java @@ -17,6 +17,7 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -92,7 +93,7 @@ class PicoTTSAudioStream extends FixedLengthAudioStream implements Disposable { */ private String generateOutputFilename() throws AudioException { try { - File tempFile = File.createTempFile(Integer.toString(text.hashCode()), ".wav"); + File tempFile = Files.createTempFile(Integer.toString(text.hashCode()), ".wav").toFile(); tempFile.deleteOnExit(); return tempFile.getAbsolutePath(); } catch (IOException e) {