diff --git a/src/main/java/stirling/software/SPDF/utils/misc/CustomColorReplaceStrategy.java b/src/main/java/stirling/software/SPDF/utils/misc/CustomColorReplaceStrategy.java index 3c5753f0..de548881 100644 --- a/src/main/java/stirling/software/SPDF/utils/misc/CustomColorReplaceStrategy.java +++ b/src/main/java/stirling/software/SPDF/utils/misc/CustomColorReplaceStrategy.java @@ -5,6 +5,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; +import java.nio.file.Files; import java.util.List; import java.util.Set; @@ -53,7 +54,7 @@ public class CustomColorReplaceStrategy extends ReplaceAndInvertColorStrategy { } // Create a temporary file, with the original filename from the multipart file - File file = File.createTempFile("temp", getFileInput().getOriginalFilename()); + File file = Files.createTempFile("temp", getFileInput().getOriginalFilename()).toFile(); // Transfer the content of the multipart file to the file getFileInput().transferTo(file); diff --git a/src/main/java/stirling/software/SPDF/utils/misc/InvertFullColorStrategy.java b/src/main/java/stirling/software/SPDF/utils/misc/InvertFullColorStrategy.java index 12cd5204..e32c1375 100644 --- a/src/main/java/stirling/software/SPDF/utils/misc/InvertFullColorStrategy.java +++ b/src/main/java/stirling/software/SPDF/utils/misc/InvertFullColorStrategy.java @@ -6,6 +6,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; +import java.nio.file.Files; import javax.imageio.ImageIO; @@ -30,7 +31,7 @@ public class InvertFullColorStrategy extends ReplaceAndInvertColorStrategy { public InputStreamResource replace() throws IOException { // Create a temporary file, with the original filename from the multipart file - File file = File.createTempFile("temp", getFileInput().getOriginalFilename()); + File file = Files.createTempFile("temp", getFileInput().getOriginalFilename()).toFile(); // Transfer the content of the multipart file to the file getFileInput().transferTo(file);