You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Closesgh-41905
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/AbstractLoggingSystemTests.java
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,8 @@
17
17
packageorg.springframework.boot.logging;
18
18
19
19
importjava.io.File;
20
+
importjava.io.IOException;
21
+
importjava.nio.file.Files;
20
22
importjava.nio.file.Path;
21
23
importjava.util.Arrays;
22
24
@@ -43,8 +45,10 @@ public abstract class AbstractLoggingSystemTests {
0 commit comments