From 23e7028abb8f7bde9cdca05acbfdd589ff595f6a Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 20 Nov 2014 12:00:19 +0000 Subject: [PATCH] Ensure java.io.tmpdir is available before using it Some environments do not have a tmpdir so it can be null. --- .../boot/logging/LoggingApplicationListener.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java index 8b465da0a8..d3eee2c1a9 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java @@ -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); + } } }