Skip to content

Commit f8fdcc1

Browse files
committed
Include value of java.io.tmpdir in message when createTempFile fails
If java.io.tmpdir is configured to a directory that does not exist, calls to File.createTempFile will fail with an IOException with the message "The system cannot find the path specified". Unfortunately, the path the was specified is not included in the message. Rather than trying to automatically create the directory in what may be a misconfigured location, we now include the value of java.io.tmpdir in our own exception's message. Hopefully this will help users to figure out what they've done wrong. Closes gh-3307
1 parent 982b81c commit f8fdcc1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ private File createTempDir(String prefix) {
388388
}
389389
catch (IOException ex) {
390390
throw new EmbeddedServletContainerException(
391-
"Unable to create Tomcat tempdir", ex);
391+
"Unable to create Tomcat tempdir. java.io.tmpdir is set to "
392+
+ System.getProperty("java.io.tmpdir"), ex);
392393
}
393394
}
394395

0 commit comments

Comments
 (0)