spring-boot/spring-boot-project
Andy Wilkinson 7a898cbbec Prevent custom java.io.tmpdir from polluting JVM's temp file creation
If java.nio.file.Files.createTempFile or
java.io.File.createTempFile(String, String) is called for the first
time while the java.io.tmpdir system property is set to a custom
value, the JVM's temporary file creation will then try to use that
custom temporary directory for all subsequent file creation. This
can result in failures if the custom temporary directory is deleted
and the JVM then tries to use it.

This commit avoids the problem by calls the two createTempFile
methods while the default java.io.tmpdir value is in place. This
ensures that the JVM will use this original temporary directory for
all of its subsequent temporary file creation while allowing the
tests to use a custom location without unwanted side-effects.

Closes gh-41905
2024-08-16 19:19:15 +01:00
..