Commit 23e7028a authored by Dave Syer's avatar Dave Syer

Ensure java.io.tmpdir is available before using it

Some environments do not have a tmpdir so it can be null.
parent 59ebc3b3
...@@ -168,6 +168,7 @@ public class LoggingApplicationListener implements SmartApplicationListener { ...@@ -168,6 +168,7 @@ public class LoggingApplicationListener implements SmartApplicationListener {
// Logback won't read backslashes so add a clean path for it to use // Logback won't read backslashes so add a clean path for it to use
if (!StringUtils.hasLength(System.getProperty("LOG_TEMP"))) { if (!StringUtils.hasLength(System.getProperty("LOG_TEMP"))) {
String path = System.getProperty("java.io.tmpdir"); String path = System.getProperty("java.io.tmpdir");
if (path!=null) {
path = StringUtils.cleanPath(path); path = StringUtils.cleanPath(path);
if (path.endsWith("/")) { if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1); path = path.substring(0, path.length() - 1);
...@@ -175,6 +176,7 @@ public class LoggingApplicationListener implements SmartApplicationListener { ...@@ -175,6 +176,7 @@ public class LoggingApplicationListener implements SmartApplicationListener {
System.setProperty("LOG_TEMP", path); System.setProperty("LOG_TEMP", path);
} }
} }
}
private boolean mapSystemPropertiesFromSpring(Environment environment) { private boolean mapSystemPropertiesFromSpring(Environment environment) {
boolean changed = false; boolean changed = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment