Prevent potential NPE when the os.name property cannot be accessed
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/9b8a17f4 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/9b8a17f4 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/9b8a17f4 Branch: refs/heads/master Commit: 9b8a17f4c4d9e2f157412fc2f2ea773064b77c8e Parents: 31f68af Author: Matt Sicker <[email protected]> Authored: Sat Oct 14 12:11:28 2017 -0500 Committer: Matt Sicker <[email protected]> Committed: Sat Oct 14 12:11:28 2017 -0500 ---------------------------------------------------------------------- .../main/java/org/apache/logging/log4j/util/PropertiesUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9b8a17f4/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java ---------------------------------------------------------------------- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java index 472088d..f5e1ecb 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java @@ -434,7 +434,7 @@ public final class PropertiesUtil { * @return true if system properties tell us we are running on Windows. */ public boolean isOsWindows() { - return getStringProperty("os.name").startsWith("Windows"); + return getStringProperty("os.name", "").startsWith("Windows"); } }
