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
This commit is contained in:
Andy Wilkinson 2015-06-24 17:08:16 +01:00
parent 982b81c675
commit f8fdcc1312
1 changed files with 2 additions and 1 deletions

View File

@ -388,7 +388,8 @@ public class TomcatEmbeddedServletContainerFactory extends
}
catch (IOException ex) {
throw new EmbeddedServletContainerException(
"Unable to create Tomcat tempdir", ex);
"Unable to create Tomcat tempdir. java.io.tmpdir is set to "
+ System.getProperty("java.io.tmpdir"), ex);
}
}