Browse Source

Ensure java.io.tmpdir is available before using it

Some environments do not have a tmpdir so it can be null.
pull/2035/head
Dave Syer 12 years ago
parent
commit
23e7028abb
  1. 12
      spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java

12
spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java

@ -168,11 +168,13 @@ public class LoggingApplicationListener implements SmartApplicationListener { @@ -168,11 +168,13 @@ public class LoggingApplicationListener implements SmartApplicationListener {
// Logback won't read backslashes so add a clean path for it to use
if (!StringUtils.hasLength(System.getProperty("LOG_TEMP"))) {
String path = System.getProperty("java.io.tmpdir");
path = StringUtils.cleanPath(path);
if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
System.setProperty("LOG_TEMP", path);
if (path!=null) {
path = StringUtils.cleanPath(path);
if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
System.setProperty("LOG_TEMP", path);
}
}
}

Loading…
Cancel
Save