Skip to content

Commit 23e7028

Browse files
author
Dave Syer
committed
Ensure java.io.tmpdir is available before using it
Some environments do not have a tmpdir so it can be null.
1 parent 59ebc3b commit 23e7028

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,13 @@ private void cleanLogTempProperty() {
168168
// Logback won't read backslashes so add a clean path for it to use
169169
if (!StringUtils.hasLength(System.getProperty("LOG_TEMP"))) {
170170
String path = System.getProperty("java.io.tmpdir");
171-
path = StringUtils.cleanPath(path);
172-
if (path.endsWith("/")) {
173-
path = path.substring(0, path.length() - 1);
174-
}
175-
System.setProperty("LOG_TEMP", path);
171+
if (path!=null) {
172+
path = StringUtils.cleanPath(path);
173+
if (path.endsWith("/")) {
174+
path = path.substring(0, path.length() - 1);
175+
}
176+
System.setProperty("LOG_TEMP", path);
177+
}
176178
}
177179
}
178180

0 commit comments

Comments
 (0)